summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp42
-rw-r--r--kaddressbook/viewmanager.cpp7
-rw-r--r--kaddressbook/viewmanager.h1
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
5 files changed, 48 insertions, 15 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 94c37e7..2ffa357 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -1,147 +1,150 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28 28
29#include <kdialog.h> 29#include <kdialog.h>
30#include <klineedit.h> 30#include <klineedit.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33 33
34#include "incsearchwidget.h" 34#include "incsearchwidget.h"
35 35
36IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 36IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
37 : QWidget( parent, name ) 37 : QWidget( parent, name )
38{ 38{
39#ifndef KAB_EMBEDDED 39#ifndef KAB_EMBEDDED
40//US setCaption( i18n( "Incremental Search" ) ); 40//US setCaption( i18n( "Incremental Search" ) );
41#endif //KAB_EMBEDDED 41#endif //KAB_EMBEDDED
42 42
43 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); 43 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
44 44
45#ifdef DESKTOP_VERSION 45#ifdef DESKTOP_VERSION
46 QLabel *label = new QLabel( i18n( "Search:" ), this ); 46 QLabel *label = new QLabel( i18n( "Search:" ), this );
47 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); 47 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
48 layout->addWidget( label ); 48 layout->addWidget( label );
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50 50
51 mSearchText = new KLineEdit( this ); 51 mSearchText = new KLineEdit( this );
52 layout->addWidget( mSearchText ); 52 layout->addWidget( mSearchText );
53// #ifdef KAB_EMBEDDED 53// #ifdef KAB_EMBEDDED
54// if (KGlobal::getOrientation() == KGlobal::Portrait) 54// if (KGlobal::getOrientation() == KGlobal::Portrait)
55// mSearchText->setMaximumWidth(30); 55// mSearchText->setMaximumWidth(30);
56// #endif //KAB_EMBEDDED 56// #endif //KAB_EMBEDDED
57 57
58 58
59 mFieldCombo = new QComboBox( false, this ); 59 mFieldCombo = new QComboBox( false, this );
60 layout->addWidget( mFieldCombo ); 60 layout->addWidget( mFieldCombo );
61 mFieldCombo->setMaximumHeight( 34 ); 61 mFieldCombo->setMaximumHeight( 34 );
62 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 62 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
63 63
64// #ifndef KAB_EMBEDDED 64// #ifndef KAB_EMBEDDED
65// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 65// resize( QSize(420, 50).expandedTo( sizeHint() ) );
66// #else //KAB_EMBEDDED 66// #else //KAB_EMBEDDED
67// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 67// resize( QSize(30, 10).expandedTo( sizeHint() ) );
68// #endif //KAB_EMBEDDED 68// #endif //KAB_EMBEDDED
69 69
70#ifdef DESKTOP_VERSION
71 // for performance reasons, we do a search on the pda only after return is pressed
70 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 72 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
71 SLOT( announceDoSearch() ) ); 73 SLOT( announceDoSearch() ) );
72 connect( mSearchText, SIGNAL( returnPressed() ),
73 SLOT( announceDoSearch() ) );
74 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 74 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
75 SLOT( announceDoSearch() ) ); 75 SLOT( announceDoSearch() ) );
76#endif
77 connect( mSearchText, SIGNAL( returnPressed() ),
78 SLOT( announceDoSearch() ) );
76 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 79 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
77 SLOT( announceFieldChanged() ) ); 80 SLOT( announceFieldChanged() ) );
78 81
79 setFocusProxy( mSearchText ); 82 setFocusProxy( mSearchText );
80} 83}
81 84
82IncSearchWidget::~IncSearchWidget() 85IncSearchWidget::~IncSearchWidget()
83{ 86{
84 87
85} 88}
86 89
87void IncSearchWidget::announceDoSearch() 90void IncSearchWidget::announceDoSearch()
88{ 91{
89 emit doSearch( mSearchText->text() ); 92 emit doSearch( mSearchText->text() );
90} 93}
91 94
92void IncSearchWidget::announceFieldChanged() 95void IncSearchWidget::announceFieldChanged()
93{ 96{
94 emit fieldChanged(); 97 emit fieldChanged();
95} 98}
96 99
97void IncSearchWidget::setFields( const KABC::Field::List &list ) 100void IncSearchWidget::setFields( const KABC::Field::List &list )
98{ 101{
99 102
100 mFieldCombo->clear(); 103 mFieldCombo->clear();
101 mFieldCombo->insertItem( i18n( "All Fields" ) ); 104 mFieldCombo->insertItem( i18n( "All Fields" ) );
102 QFontMetrics fm ( mFieldCombo->font() ); 105 QFontMetrics fm ( mFieldCombo->font() );
103 int wid = fm.width(i18n( "All Fields" ) ); 106 int wid = fm.width(i18n( "All Fields" ) );
104 int max = wid; 107 int max = wid;
105 108
106 KABC::Field::List::ConstIterator it; 109 KABC::Field::List::ConstIterator it;
107 for ( it = list.begin(); it != list.end(); ++it ) { 110 for ( it = list.begin(); it != list.end(); ++it ) {
108 mFieldCombo->insertItem( (*it)->label() ); 111 mFieldCombo->insertItem( (*it)->label() );
109 // wid = fm.width((*it)->label() ); 112 // wid = fm.width((*it)->label() );
110 //if ( wid > max ) 113 //if ( wid > max )
111 // max = wid; 114 // max = wid;
112 } 115 }
113 116
114 mFieldList = list; 117 mFieldList = list;
115 118
116 announceDoSearch(); 119 announceDoSearch();
117 announceFieldChanged(); 120 announceFieldChanged();
118 mFieldCombo->setMaximumWidth( wid+60 ); 121 mFieldCombo->setMaximumWidth( wid+60 );
119} 122}
120 123
121KABC::Field::List IncSearchWidget::fields() const 124KABC::Field::List IncSearchWidget::fields() const
122{ 125{
123 return mFieldList; 126 return mFieldList;
124} 127}
125 128
126KABC::Field *IncSearchWidget::currentField()const 129KABC::Field *IncSearchWidget::currentField()const
127{ 130{
128 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 131 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
129 return 0; // for error or 'use all fields' 132 return 0; // for error or 'use all fields'
130 else 133 else
131 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 134 return mFieldList[ mFieldCombo->currentItem() - 1 ];
132} 135}
133 136
134void IncSearchWidget::setCurrentItem( int pos ) 137void IncSearchWidget::setCurrentItem( int pos )
135{ 138{
136 mFieldCombo->setCurrentItem( pos ); 139 mFieldCombo->setCurrentItem( pos );
137 announceFieldChanged(); 140 announceFieldChanged();
138} 141}
139 142
140int IncSearchWidget::currentItem() const 143int IncSearchWidget::currentItem() const
141{ 144{
142 145
143 return mFieldCombo->currentItem(); 146 return mFieldCombo->currentItem();
144} 147}
145#ifndef KAB_EMBEDDED 148#ifndef KAB_EMBEDDED
146#include "incsearchwidget.moc" 149#include "incsearchwidget.moc"
147#endif //KAB_EMBEDDED 150#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f0f08f4..4299ebd 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -644,411 +644,433 @@ void KABCore::beamVCard(const QStringList& uids)
644 644
645 QFile outFile(fileName); 645 QFile outFile(fileName);
646 KABC::VCardConverter converter; 646 KABC::VCardConverter converter;
647 QString description; 647 QString description;
648 648
649 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 649 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
650 650
651 QTextStream t( &outFile ); // use a text stream 651 QTextStream t( &outFile ); // use a text stream
652 t.setEncoding( QTextStream::UnicodeUTF8 ); 652 t.setEncoding( QTextStream::UnicodeUTF8 );
653 653
654 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 654 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
655 KABC::Addressee a = mAddressBook->findByUid( *it ); 655 KABC::Addressee a = mAddressBook->findByUid( *it );
656 656
657 if ( a.isEmpty() ) 657 if ( a.isEmpty() )
658 continue; 658 continue;
659 659
660 if (description.isEmpty()) 660 if (description.isEmpty())
661 description = a.formattedName(); 661 description = a.formattedName();
662 662
663 QString vcard; 663 QString vcard;
664 converter.addresseeToVCard( a, vcard ); 664 converter.addresseeToVCard( a, vcard );
665 t << vcard; 665 t << vcard;
666 666
667 } 667 }
668 } else { 668 } else {
669 qDebug("Error open temp beam file "); 669 qDebug("Error open temp beam file ");
670 return; 670 return;
671 } 671 }
672 672
673 outFile.close(); 673 outFile.close();
674 674
675#ifndef DESKTOP_VERSION 675#ifndef DESKTOP_VERSION
676 Ir *ir = new Ir( this ); 676 Ir *ir = new Ir( this );
677 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 677 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
678 ir->send( fileName, description, "text/x-vCard" ); 678 ir->send( fileName, description, "text/x-vCard" );
679#endif 679#endif
680 680
681} 681}
682 682
683void KABCore::beamDone( Ir *ir ) 683void KABCore::beamDone( Ir *ir )
684{ 684{
685#ifndef DESKTOP_VERSION 685#ifndef DESKTOP_VERSION
686 delete ir; 686 delete ir;
687#endif 687#endif
688} 688}
689 689
690 690
691void KABCore::browse( const QString& url ) 691void KABCore::browse( const QString& url )
692{ 692{
693#ifndef KAB_EMBEDDED 693#ifndef KAB_EMBEDDED
694 kapp->invokeBrowser( url ); 694 kapp->invokeBrowser( url );
695#else //KAB_EMBEDDED 695#else //KAB_EMBEDDED
696 qDebug("KABCore::browse must be fixed"); 696 qDebug("KABCore::browse must be fixed");
697#endif //KAB_EMBEDDED 697#endif //KAB_EMBEDDED
698} 698}
699 699
700void KABCore::selectAllContacts() 700void KABCore::selectAllContacts()
701{ 701{
702 mViewManager->setSelected( QString::null, true ); 702 mViewManager->setSelected( QString::null, true );
703} 703}
704 704
705void KABCore::deleteContacts() 705void KABCore::deleteContacts()
706{ 706{
707 QStringList uidList = mViewManager->selectedUids(); 707 QStringList uidList = mViewManager->selectedUids();
708 deleteContacts( uidList ); 708 deleteContacts( uidList );
709} 709}
710 710
711void KABCore::deleteContacts( const QStringList &uids ) 711void KABCore::deleteContacts( const QStringList &uids )
712{ 712{
713 if ( uids.count() > 0 ) { 713 if ( uids.count() > 0 ) {
714 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 714 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
715 UndoStack::instance()->push( command ); 715 UndoStack::instance()->push( command );
716 RedoStack::instance()->clear(); 716 RedoStack::instance()->clear();
717 717
718 // now if we deleted anything, refresh 718 // now if we deleted anything, refresh
719 setContactSelected( QString::null ); 719 setContactSelected( QString::null );
720 setModified( true ); 720 setModified( true );
721 } 721 }
722} 722}
723 723
724void KABCore::copyContacts() 724void KABCore::copyContacts()
725{ 725{
726 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 726 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
727 727
728 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 728 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
729 729
730 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 730 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
731 731
732 QClipboard *cb = QApplication::clipboard(); 732 QClipboard *cb = QApplication::clipboard();
733 cb->setText( clipText ); 733 cb->setText( clipText );
734} 734}
735 735
736void KABCore::cutContacts() 736void KABCore::cutContacts()
737{ 737{
738 QStringList uidList = mViewManager->selectedUids(); 738 QStringList uidList = mViewManager->selectedUids();
739 739
740//US if ( uidList.size() > 0 ) { 740//US if ( uidList.size() > 0 ) {
741 if ( uidList.count() > 0 ) { 741 if ( uidList.count() > 0 ) {
742 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 742 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
743 UndoStack::instance()->push( command ); 743 UndoStack::instance()->push( command );
744 RedoStack::instance()->clear(); 744 RedoStack::instance()->clear();
745 745
746 setModified( true ); 746 setModified( true );
747 } 747 }
748} 748}
749 749
750void KABCore::pasteContacts() 750void KABCore::pasteContacts()
751{ 751{
752 QClipboard *cb = QApplication::clipboard(); 752 QClipboard *cb = QApplication::clipboard();
753 753
754 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 754 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
755 755
756 pasteContacts( list ); 756 pasteContacts( list );
757} 757}
758 758
759void KABCore::pasteContacts( KABC::Addressee::List &list ) 759void KABCore::pasteContacts( KABC::Addressee::List &list )
760{ 760{
761 KABC::Resource *resource = requestResource( this ); 761 KABC::Resource *resource = requestResource( this );
762 KABC::Addressee::List::Iterator it; 762 KABC::Addressee::List::Iterator it;
763 for ( it = list.begin(); it != list.end(); ++it ) 763 for ( it = list.begin(); it != list.end(); ++it )
764 (*it).setResource( resource ); 764 (*it).setResource( resource );
765 765
766 PwPasteCommand *command = new PwPasteCommand( this, list ); 766 PwPasteCommand *command = new PwPasteCommand( this, list );
767 UndoStack::instance()->push( command ); 767 UndoStack::instance()->push( command );
768 RedoStack::instance()->clear(); 768 RedoStack::instance()->clear();
769 769
770 setModified( true ); 770 setModified( true );
771} 771}
772 772
773void KABCore::setWhoAmI() 773void KABCore::setWhoAmI()
774{ 774{
775 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 775 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
776 776
777 if ( addrList.count() > 1 ) { 777 if ( addrList.count() > 1 ) {
778 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 778 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
779 return; 779 return;
780 } 780 }
781 781
782 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 782 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
783 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 783 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
784 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 784 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
785} 785}
786 786
787void KABCore::setCategories() 787void KABCore::setCategories()
788{ 788{
789 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 789 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
790 if ( !dlg.exec() ) 790 if ( !dlg.exec() )
791 return; 791 return;
792 792
793 bool merge = false; 793 bool merge = false;
794 QString msg = i18n( "Merge with existing categories?" ); 794 QString msg = i18n( "Merge with existing categories?" );
795 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 795 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
796 merge = true; 796 merge = true;
797 797
798 QStringList categories = dlg.selectedCategories(); 798 QStringList categories = dlg.selectedCategories();
799 799
800 QStringList uids = mViewManager->selectedUids(); 800 QStringList uids = mViewManager->selectedUids();
801 QStringList::Iterator it; 801 QStringList::Iterator it;
802 for ( it = uids.begin(); it != uids.end(); ++it ) { 802 for ( it = uids.begin(); it != uids.end(); ++it ) {
803 KABC::Addressee addr = mAddressBook->findByUid( *it ); 803 KABC::Addressee addr = mAddressBook->findByUid( *it );
804 if ( !addr.isEmpty() ) { 804 if ( !addr.isEmpty() ) {
805 if ( !merge ) 805 if ( !merge )
806 addr.setCategories( categories ); 806 addr.setCategories( categories );
807 else { 807 else {
808 QStringList addrCategories = addr.categories(); 808 QStringList addrCategories = addr.categories();
809 QStringList::Iterator catIt; 809 QStringList::Iterator catIt;
810 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 810 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
811 if ( !addrCategories.contains( *catIt ) ) 811 if ( !addrCategories.contains( *catIt ) )
812 addrCategories.append( *catIt ); 812 addrCategories.append( *catIt );
813 } 813 }
814 addr.setCategories( addrCategories ); 814 addr.setCategories( addrCategories );
815 } 815 }
816 816
817 mAddressBook->insertAddressee( addr ); 817 mAddressBook->insertAddressee( addr );
818 } 818 }
819 } 819 }
820 820
821 if ( uids.count() > 0 ) 821 if ( uids.count() > 0 )
822 setModified( true ); 822 setModified( true );
823} 823}
824 824
825void KABCore::setSearchFields( const KABC::Field::List &fields ) 825void KABCore::setSearchFields( const KABC::Field::List &fields )
826{ 826{
827 mIncSearchWidget->setFields( fields ); 827 mIncSearchWidget->setFields( fields );
828} 828}
829 829
830void KABCore::incrementalSearch( const QString& text ) 830void KABCore::incrementalSearch( const QString& text )
831{ 831{
832 mViewManager->setSelected( QString::null, false ); 832 mViewManager->setSelected( QString::null, false );
833 833
834 if ( !text.isEmpty() ) { 834 if ( !text.isEmpty() ) {
835 KABC::Field *field = mIncSearchWidget->currentField(); 835 KABC::Field *field = mIncSearchWidget->currentField();
836 836 QString pattern = text.lower()+"*";
837 QString pattern = text.lower(); 837 QRegExp re;
838 838 re.setWildcard(true); // most people understand these better.
839 re.setCaseSensitive(false);
840 re.setPattern( pattern );
841 QStringList foundUids;
842 if (!re.isValid())
843 return;
839#if 1 //KDE_VERSION >= 319 844#if 1 //KDE_VERSION >= 319
840 KABC::AddresseeList list( mAddressBook->allAddressees() ); 845 KABC::AddresseeList list( mAddressBook->allAddressees() );
841 if ( field ) { 846 if ( field ) {
842 list.sortByField( field ); 847 list.sortByField( field );
843 KABC::AddresseeList::Iterator it; 848 KABC::AddresseeList::Iterator it;
844 for ( it = list.begin(); it != list.end(); ++it ) { 849 for ( it = list.begin(); it != list.end(); ++it ) {
845 if ( field->value( *it ).lower().startsWith( pattern ) ) { 850
846 mViewManager->setSelected( (*it).uid(), true ); 851#if QT_VERSION >= 300
847 return; 852 if (re.search(field->value( *it ).lower()) != -1)
848 } 853#else
854 if (re.match(field->value( *it ).lower()) != -1)
855#endif
856 {
857 // if ( field->value( *it ).lower().startsWith( pattern ) ) {
858 //mViewManager->setSelected( (*it).uid(), true );
859 foundUids.append( (*it).uid() );
860 //return;
861 }
849 } 862 }
850 } else { 863 } else {
851 KABC::AddresseeList::Iterator it; 864 KABC::AddresseeList::Iterator it;
852 for ( it = list.begin(); it != list.end(); ++it ) { 865 for ( it = list.begin(); it != list.end(); ++it ) {
853 KABC::Field::List fieldList = mIncSearchWidget->fields(); 866 KABC::Field::List fieldList = mIncSearchWidget->fields();
854 KABC::Field::List::ConstIterator fieldIt; 867 KABC::Field::List::ConstIterator fieldIt;
855 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 868 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
856 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 869#if QT_VERSION >= 300
857 mViewManager->setSelected( (*it).uid(), true ); 870 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
858 return; 871#else
872 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
873#endif
874 {
875 // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
876 //mViewManager->setSelected( (*it).uid(), true );
877 foundUids.append( (*it).uid() );
878 //return;
859 } 879 }
860 } 880 }
861 } 881 }
862 } 882 }
883 if ( foundUids.count() > 0 )
884 mViewManager->setListSelected( foundUids );
863#else 885#else
864 KABC::AddressBook::Iterator it; 886 KABC::AddressBook::Iterator it;
865 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 887 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
866 if ( field ) { 888 if ( field ) {
867 if ( field->value( *it ).lower().startsWith( pattern ) ) { 889 if ( field->value( *it ).lower().startsWith( pattern ) ) {
868 mViewManager->setSelected( (*it).uid(), true ); 890 mViewManager->setSelected( (*it).uid(), true );
869 return; 891 return;
870 } 892 }
871 } else { 893 } else {
872 KABC::Field::List fieldList = mIncSearchWidget->fields(); 894 KABC::Field::List fieldList = mIncSearchWidget->fields();
873 KABC::Field::List::ConstIterator fieldIt; 895 KABC::Field::List::ConstIterator fieldIt;
874 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 896 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
875 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 897 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
876 mViewManager->setSelected( (*it).uid(), true ); 898 mViewManager->setSelected( (*it).uid(), true );
877 return; 899 return;
878 } 900 }
879 } 901 }
880 } 902 }
881 } 903 }
882#endif 904#endif
883 } 905 }
884} 906}
885 907
886void KABCore::setModified() 908void KABCore::setModified()
887{ 909{
888 setModified( true ); 910 setModified( true );
889} 911}
890 912
891void KABCore::setModifiedWOrefresh() 913void KABCore::setModifiedWOrefresh()
892{ 914{
893 // qDebug("KABCore::setModifiedWOrefresh() "); 915 // qDebug("KABCore::setModifiedWOrefresh() ");
894 mModified = true; 916 mModified = true;
895 mActionSave->setEnabled( mModified ); 917 mActionSave->setEnabled( mModified );
896#ifdef DESKTOP_VERSION 918#ifdef DESKTOP_VERSION
897 mDetails->refreshView(); 919 mDetails->refreshView();
898#endif 920#endif
899 921
900} 922}
901void KABCore::setModified( bool modified ) 923void KABCore::setModified( bool modified )
902{ 924{
903 mModified = modified; 925 mModified = modified;
904 mActionSave->setEnabled( mModified ); 926 mActionSave->setEnabled( mModified );
905 927
906 if ( modified ) 928 if ( modified )
907 mJumpButtonBar->recreateButtons(); 929 mJumpButtonBar->recreateButtons();
908 930
909 mViewManager->refreshView(); 931 mViewManager->refreshView();
910 mDetails->refreshView(); 932 mDetails->refreshView();
911 933
912} 934}
913 935
914bool KABCore::modified() const 936bool KABCore::modified() const
915{ 937{
916 return mModified; 938 return mModified;
917} 939}
918 940
919void KABCore::contactModified( const KABC::Addressee &addr ) 941void KABCore::contactModified( const KABC::Addressee &addr )
920{ 942{
921 943
922 Command *command = 0; 944 Command *command = 0;
923 QString uid; 945 QString uid;
924 946
925 // check if it exists already 947 // check if it exists already
926 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 948 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
927 if ( origAddr.isEmpty() ) 949 if ( origAddr.isEmpty() )
928 command = new PwNewCommand( mAddressBook, addr ); 950 command = new PwNewCommand( mAddressBook, addr );
929 else { 951 else {
930 command = new PwEditCommand( mAddressBook, origAddr, addr ); 952 command = new PwEditCommand( mAddressBook, origAddr, addr );
931 uid = addr.uid(); 953 uid = addr.uid();
932 } 954 }
933 955
934 UndoStack::instance()->push( command ); 956 UndoStack::instance()->push( command );
935 RedoStack::instance()->clear(); 957 RedoStack::instance()->clear();
936 958
937 setModified( true ); 959 setModified( true );
938} 960}
939 961
940void KABCore::newContact() 962void KABCore::newContact()
941{ 963{
942 964
943 965
944 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 966 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
945 967
946 QPtrList<KRES::Resource> kresResources; 968 QPtrList<KRES::Resource> kresResources;
947 QPtrListIterator<KABC::Resource> it( kabcResources ); 969 QPtrListIterator<KABC::Resource> it( kabcResources );
948 KABC::Resource *resource; 970 KABC::Resource *resource;
949 while ( ( resource = it.current() ) != 0 ) { 971 while ( ( resource = it.current() ) != 0 ) {
950 ++it; 972 ++it;
951 if ( !resource->readOnly() ) { 973 if ( !resource->readOnly() ) {
952 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 974 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
953 if ( res ) 975 if ( res )
954 kresResources.append( res ); 976 kresResources.append( res );
955 } 977 }
956 } 978 }
957 979
958 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 980 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
959 resource = static_cast<KABC::Resource*>( res ); 981 resource = static_cast<KABC::Resource*>( res );
960 982
961 if ( resource ) { 983 if ( resource ) {
962 KABC::Addressee addr; 984 KABC::Addressee addr;
963 addr.setResource( resource ); 985 addr.setResource( resource );
964 mEditorDialog->setAddressee( addr ); 986 mEditorDialog->setAddressee( addr );
965 KApplication::execDialog ( mEditorDialog ); 987 KApplication::execDialog ( mEditorDialog );
966 988
967 } else 989 } else
968 return; 990 return;
969 991
970 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 992 // mEditorDict.insert( dialog->addressee().uid(), dialog );
971 993
972 994
973} 995}
974 996
975void KABCore::addEmail( QString aStr ) 997void KABCore::addEmail( QString aStr )
976{ 998{
977#ifndef KAB_EMBEDDED 999#ifndef KAB_EMBEDDED
978 QString fullName, email; 1000 QString fullName, email;
979 1001
980 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1002 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
981 1003
982 // Try to lookup the addressee matching the email address 1004 // Try to lookup the addressee matching the email address
983 bool found = false; 1005 bool found = false;
984 QStringList emailList; 1006 QStringList emailList;
985 KABC::AddressBook::Iterator it; 1007 KABC::AddressBook::Iterator it;
986 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1008 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
987 emailList = (*it).emails(); 1009 emailList = (*it).emails();
988 if ( emailList.contains( email ) > 0 ) { 1010 if ( emailList.contains( email ) > 0 ) {
989 found = true; 1011 found = true;
990 (*it).setNameFromString( fullName ); 1012 (*it).setNameFromString( fullName );
991 editContact( (*it).uid() ); 1013 editContact( (*it).uid() );
992 } 1014 }
993 } 1015 }
994 1016
995 if ( !found ) { 1017 if ( !found ) {
996 KABC::Addressee addr; 1018 KABC::Addressee addr;
997 addr.setNameFromString( fullName ); 1019 addr.setNameFromString( fullName );
998 addr.insertEmail( email, true ); 1020 addr.insertEmail( email, true );
999 1021
1000 mAddressBook->insertAddressee( addr ); 1022 mAddressBook->insertAddressee( addr );
1001 mViewManager->refreshView( addr.uid() ); 1023 mViewManager->refreshView( addr.uid() );
1002 editContact( addr.uid() ); 1024 editContact( addr.uid() );
1003 } 1025 }
1004#else //KAB_EMBEDDED 1026#else //KAB_EMBEDDED
1005 qDebug("KABCore::addEmail finsih method"); 1027 qDebug("KABCore::addEmail finsih method");
1006#endif //KAB_EMBEDDED 1028#endif //KAB_EMBEDDED
1007} 1029}
1008 1030
1009void KABCore::importVCard( const KURL &url, bool showPreview ) 1031void KABCore::importVCard( const KURL &url, bool showPreview )
1010{ 1032{
1011 mXXPortManager->importVCard( url, showPreview ); 1033 mXXPortManager->importVCard( url, showPreview );
1012} 1034}
1013void KABCore::importFromOL() 1035void KABCore::importFromOL()
1014{ 1036{
1015#ifdef _WIN32_ 1037#ifdef _WIN32_
1016 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1038 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1017 idgl->exec(); 1039 idgl->exec();
1018 KABC::Addressee::List list = idgl->getAddressList(); 1040 KABC::Addressee::List list = idgl->getAddressList();
1019 if ( list.count() > 0 ) { 1041 if ( list.count() > 0 ) {
1020 KABC::Addressee::List listNew; 1042 KABC::Addressee::List listNew;
1021 KABC::Addressee::List listExisting; 1043 KABC::Addressee::List listExisting;
1022 KABC::Addressee::List::Iterator it; 1044 KABC::Addressee::List::Iterator it;
1023 KABC::AddressBook::Iterator iter; 1045 KABC::AddressBook::Iterator iter;
1024 for ( it = list.begin(); it != list.end(); ++it ) { 1046 for ( it = list.begin(); it != list.end(); ++it ) {
1025 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1047 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1026 listNew.append( (*it) ); 1048 listNew.append( (*it) );
1027 else 1049 else
1028 listExisting.append( (*it) ); 1050 listExisting.append( (*it) );
1029 } 1051 }
1030 if ( listExisting.count() > 0 ) 1052 if ( listExisting.count() > 0 )
1031 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1053 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1032 if ( listNew.count() > 0 ) { 1054 if ( listNew.count() > 0 ) {
1033 pasteWithNewUid = false; 1055 pasteWithNewUid = false;
1034 pasteContacts( listNew ); 1056 pasteContacts( listNew );
1035 pasteWithNewUid = true; 1057 pasteWithNewUid = true;
1036 } 1058 }
1037 } 1059 }
1038 delete idgl; 1060 delete idgl;
1039#endif 1061#endif
1040} 1062}
1041 1063
1042void KABCore::importVCard( const QString &vCard, bool showPreview ) 1064void KABCore::importVCard( const QString &vCard, bool showPreview )
1043{ 1065{
1044 mXXPortManager->importVCard( vCard, showPreview ); 1066 mXXPortManager->importVCard( vCard, showPreview );
1045} 1067}
1046 1068
1047//US added a second method without defaultparameter 1069//US added a second method without defaultparameter
1048void KABCore::editContact2() { 1070void KABCore::editContact2() {
1049 editContact( QString::null ); 1071 editContact( QString::null );
1050} 1072}
1051 1073
1052void KABCore::editContact( const QString &uid ) 1074void KABCore::editContact( const QString &uid )
1053{ 1075{
1054 1076
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 45c7b55..c93d51a 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -1,372 +1,379 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31 31
32#ifndef KAB_EMBEDDED 32#ifndef KAB_EMBEDDED
33#include <libkdepim/kvcarddrag.h> 33#include <libkdepim/kvcarddrag.h>
34#include <kabc/vcardconverter.h> 34#include <kabc/vcardconverter.h>
35#include <kconfig.h> 35#include <kconfig.h>
36#include <kdeversion.h> 36#include <kdeversion.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include <klocale.h> 38#include <klocale.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kmultipledrag.h> 40#include <kmultipledrag.h>
41#include <ktrader.h> 41#include <ktrader.h>
42#include <kurldrag.h> 42#include <kurldrag.h>
43 43
44#include "addresseeutil.h" 44#include "addresseeutil.h"
45#else //KAB_EMBEDDED 45#else //KAB_EMBEDDED
46#include "views/kaddressbookiconview.h" 46#include "views/kaddressbookiconview.h"
47#include "views/kaddressbooktableview.h" 47#include "views/kaddressbooktableview.h"
48#include "views/kaddressbookcardview.h" 48#include "views/kaddressbookcardview.h"
49#include "kaddressbookview.h" 49#include "kaddressbookview.h"
50 50
51#include <qaction.h> 51#include <qaction.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54#include <kconfigbase.h> 54#include <kconfigbase.h>
55 55
56#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
57 57
58 58
59#include <kdebug.h> 59#include <kdebug.h>
60#include <kactionclasses.h> 60#include <kactionclasses.h>
61 61
62#include <qlayout.h> 62#include <qlayout.h>
63#include <qwidgetstack.h> 63#include <qwidgetstack.h>
64 64
65#include <kabc/addressbook.h> 65#include <kabc/addressbook.h>
66#include "filtereditdialog.h" 66#include "filtereditdialog.h"
67#include "addviewdialog.h" 67#include "addviewdialog.h"
68#include "kabcore.h" 68#include "kabcore.h"
69#include "kabprefs.h" 69#include "kabprefs.h"
70#include "viewmanager.h" 70#include "viewmanager.h"
71 71
72ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) 72ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name )
73 : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) 73 : QWidget( parent, name ), mCore( core ), mActiveView( 0 )
74{ 74{
75 initGUI(); 75 initGUI();
76 initActions(); 76 initActions();
77 77
78 mViewDict.setAutoDelete( true ); 78 mViewDict.setAutoDelete( true );
79 79
80 createViewFactories(); 80 createViewFactories();
81} 81}
82 82
83ViewManager::~ViewManager() 83ViewManager::~ViewManager()
84{ 84{
85 unloadViews(); 85 unloadViews();
86 mViewFactoryDict.clear(); 86 mViewFactoryDict.clear();
87} 87}
88 88
89void ViewManager::restoreSettings() 89void ViewManager::restoreSettings()
90{ 90{
91 mViewNameList = KABPrefs::instance()->mViewNames; 91 mViewNameList = KABPrefs::instance()->mViewNames;
92 QString activeViewName = KABPrefs::instance()->mCurrentView; 92 QString activeViewName = KABPrefs::instance()->mCurrentView;
93 93
94 mActionSelectView->setItems( mViewNameList ); 94 mActionSelectView->setItems( mViewNameList );
95 95
96 // Filter 96 // Filter
97 mFilterList = Filter::restore( mCore->config(), "Filter" ); 97 mFilterList = Filter::restore( mCore->config(), "Filter" );
98 mActionSelectFilter->setItems( filterNames() ); 98 mActionSelectFilter->setItems( filterNames() );
99 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); 99 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
100 100
101 // Tell the views to reread their config, since they may have 101 // Tell the views to reread their config, since they may have
102 // been modified by global settings 102 // been modified by global settings
103 QString _oldgroup = mCore->config()->group(); 103 QString _oldgroup = mCore->config()->group();
104 104
105 QDictIterator<KAddressBookView> it( mViewDict ); 105 QDictIterator<KAddressBookView> it( mViewDict );
106 for ( it.toFirst(); it.current(); ++it ) { 106 for ( it.toFirst(); it.current(); ++it ) {
107 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 107 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
108 it.current()->readConfig( mCore->config() ); 108 it.current()->readConfig( mCore->config() );
109 } 109 }
110 setActiveView( activeViewName ); 110 setActiveView( activeViewName );
111 111
112 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 112 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
113} 113}
114 114
115void ViewManager::saveSettings() 115void ViewManager::saveSettings()
116{ 116{
117 QString _oldgroup = mCore->config()->group(); 117 QString _oldgroup = mCore->config()->group();
118 118
119 QDictIterator<KAddressBookView> it( mViewDict ); 119 QDictIterator<KAddressBookView> it( mViewDict );
120 for ( it.toFirst(); it.current(); ++it ) { 120 for ( it.toFirst(); it.current(); ++it ) {
121 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 121 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
122#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
123 (*it)->writeConfig( mCore->config() ); 123 (*it)->writeConfig( mCore->config() );
124#else 124#else
125 (*it).writeConfig( mCore->config() ); 125 (*it).writeConfig( mCore->config() );
126#endif 126#endif
127 } 127 }
128 128
129 Filter::save( mCore->config(), "Filter", mFilterList ); 129 Filter::save( mCore->config(), "Filter", mFilterList );
130 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); 130 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
131 131
132 // write the view name list 132 // write the view name list
133 KABPrefs::instance()->mViewNames = mViewNameList; 133 KABPrefs::instance()->mViewNames = mViewNameList;
134 KABPrefs::instance()->mCurrentView = mActiveView->caption(); 134 KABPrefs::instance()->mCurrentView = mActiveView->caption();
135 135
136} 136}
137 137
138QStringList ViewManager::selectedUids() const 138QStringList ViewManager::selectedUids() const
139{ 139{
140 if ( mActiveView ) 140 if ( mActiveView )
141 return mActiveView->selectedUids(); 141 return mActiveView->selectedUids();
142 else 142 else
143 return QStringList(); 143 return QStringList();
144} 144}
145 145
146QStringList ViewManager::selectedEmails() const 146QStringList ViewManager::selectedEmails() const
147{ 147{
148 if ( mActiveView ) 148 if ( mActiveView )
149 return mActiveView->selectedEmails(); 149 return mActiveView->selectedEmails();
150 else 150 else
151 return QStringList(); 151 return QStringList();
152} 152}
153 153
154KABC::Addressee::List ViewManager::selectedAddressees() const 154KABC::Addressee::List ViewManager::selectedAddressees() const
155{ 155{
156 KABC::Addressee::List list; 156 KABC::Addressee::List list;
157 if ( mActiveView ) { 157 if ( mActiveView ) {
158 QStringList uids = mActiveView->selectedUids(); 158 QStringList uids = mActiveView->selectedUids();
159 QStringList::Iterator it; 159 QStringList::Iterator it;
160 for ( it = uids.begin(); it != uids.end(); ++it ) { 160 for ( it = uids.begin(); it != uids.end(); ++it ) {
161 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 161 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
162 if ( !addr.isEmpty() ) 162 if ( !addr.isEmpty() )
163 list.append( addr ); 163 list.append( addr );
164 } 164 }
165 } 165 }
166 166
167 return list; 167 return list;
168} 168}
169//US added another method with no parameter, since my moc compiler does not support default parameters. 169//US added another method with no parameter, since my moc compiler does not support default parameters.
170void ViewManager::setSelected() 170void ViewManager::setSelected()
171{ 171{
172 setSelected( QString::null, true ); 172 setSelected( QString::null, true );
173} 173}
174 174
175void ViewManager::setSelected( const QString &uid, bool selected ) 175void ViewManager::setSelected( const QString &uid, bool selected )
176{ 176{
177 if ( mActiveView ) 177 if ( mActiveView )
178 mActiveView->setSelected( uid, selected ); 178 mActiveView->setSelected( uid, selected );
179} 179}
180 180
181void ViewManager::setListSelected(QStringList list)
182{
183 int i, count = list.count();
184 for ( i = 0; i < count;++i )
185 setSelected( list[i], true );
186
187}
181void ViewManager::unloadViews() 188void ViewManager::unloadViews()
182{ 189{
183 mViewDict.clear(); 190 mViewDict.clear();
184 mActiveView = 0; 191 mActiveView = 0;
185} 192}
186 193
187void ViewManager::setActiveView( const QString &name ) 194void ViewManager::setActiveView( const QString &name )
188{ 195{
189 KAddressBookView *view = 0; 196 KAddressBookView *view = 0;
190 197
191 // Check that this isn't the same as the current active view 198 // Check that this isn't the same as the current active view
192 if ( mActiveView && ( mActiveView->caption() == name ) ) 199 if ( mActiveView && ( mActiveView->caption() == name ) )
193 return; 200 return;
194 201
195 // At this point we know the view that should be active is not 202 // At this point we know the view that should be active is not
196 // currently active. We will try to find the new on in the list. If 203 // currently active. We will try to find the new on in the list. If
197 // we can't find it, it means it hasn't been instantiated, so we will 204 // we can't find it, it means it hasn't been instantiated, so we will
198 // create it on demand. 205 // create it on demand.
199 206
200 view = mViewDict.find( name ); 207 view = mViewDict.find( name );
201 208
202 // Check if we found the view. If we didn't, then we need to create it 209 // Check if we found the view. If we didn't, then we need to create it
203 if ( view == 0 ) { 210 if ( view == 0 ) {
204 KConfig *config = mCore->config(); 211 KConfig *config = mCore->config();
205 212
206 KConfigGroupSaver saver( config, name ); 213 KConfigGroupSaver saver( config, name );
207 214
208 QString type = config->readEntry( "Type", "Table" ); 215 QString type = config->readEntry( "Type", "Table" );
209 216
210 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; 217 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
211 218
212 ViewFactory *factory = mViewFactoryDict.find( type ); 219 ViewFactory *factory = mViewFactoryDict.find( type );
213 if ( factory ) 220 if ( factory )
214 view = factory->view( mCore->addressBook(), mViewWidgetStack ); 221 view = factory->view( mCore->addressBook(), mViewWidgetStack );
215 222
216 if ( view ) { 223 if ( view ) {
217 view->setCaption( name ); 224 view->setCaption( name );
218 mViewDict.insert( name, view ); 225 mViewDict.insert( name, view );
219//US my version needs an int as second parameter to addWidget 226//US my version needs an int as second parameter to addWidget
220 mViewWidgetStack->addWidget( view, -1 ); 227 mViewWidgetStack->addWidget( view, -1 );
221 view->readConfig( config ); 228 view->readConfig( config );
222 229
223 // The manager just relays the signals 230 // The manager just relays the signals
224 connect( view, SIGNAL( selected( const QString& ) ), 231 connect( view, SIGNAL( selected( const QString& ) ),
225 SIGNAL( selected( const QString & ) ) ); 232 SIGNAL( selected( const QString & ) ) );
226 connect( view, SIGNAL( executed( const QString& ) ), 233 connect( view, SIGNAL( executed( const QString& ) ),
227 SIGNAL( executed( const QString& ) ) ); 234 SIGNAL( executed( const QString& ) ) );
228 235
229 connect( view, SIGNAL( deleteRequest( ) ), 236 connect( view, SIGNAL( deleteRequest( ) ),
230 SIGNAL( deleteRequest( ) ) ); 237 SIGNAL( deleteRequest( ) ) );
231 238
232 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); 239 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
233 connect( view, SIGNAL( dropped( QDropEvent* ) ), 240 connect( view, SIGNAL( dropped( QDropEvent* ) ),
234 SLOT( dropped( QDropEvent* ) ) ); 241 SLOT( dropped( QDropEvent* ) ) );
235 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); 242 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
236 } 243 }
237 } 244 }
238 245
239 // If we found or created the view, raise it and refresh it 246 // If we found or created the view, raise it and refresh it
240 if ( view ) { 247 if ( view ) {
241 mActiveView = view; 248 mActiveView = view;
242 mViewWidgetStack->raiseWidget( view ); 249 mViewWidgetStack->raiseWidget( view );
243 // Set the proper filter in the view. By setting the combo 250 // Set the proper filter in the view. By setting the combo
244 // box, the activated slot will be called, which will push 251 // box, the activated slot will be called, which will push
245 // the filter to the view and refresh it. 252 // the filter to the view and refresh it.
246 253
247 if ( view->defaultFilterType() == KAddressBookView::None ) { 254 if ( view->defaultFilterType() == KAddressBookView::None ) {
248 255
249 mActionSelectFilter->setCurrentItem( 0 ); 256 mActionSelectFilter->setCurrentItem( 0 );
250 setActiveFilter( 0 ); 257 setActiveFilter( 0 );
251 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 258 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
252 setActiveFilter( mActionSelectFilter->currentItem() ); 259 setActiveFilter( mActionSelectFilter->currentItem() );
253 } else { 260 } else {
254 uint pos = filterPosition( view->defaultFilterName() ); 261 uint pos = filterPosition( view->defaultFilterName() );
255 mActionSelectFilter->setCurrentItem( pos ); 262 mActionSelectFilter->setCurrentItem( pos );
256 setActiveFilter( pos ); 263 setActiveFilter( pos );
257 } 264 }
258//US qDebug("ViewManager::setActiveView 6" ); 265//US qDebug("ViewManager::setActiveView 6" );
259 266
260 // Update the inc search widget to show the fields in the new active 267 // Update the inc search widget to show the fields in the new active
261 // view. 268 // view.
262 mCore->setSearchFields( mActiveView->fields() ); 269 mCore->setSearchFields( mActiveView->fields() );
263 270
264//US performance optimization. setActiveFilter calls also mActiveView->refresh() 271//US performance optimization. setActiveFilter calls also mActiveView->refresh()
265//US mActiveView->refresh(); 272//US mActiveView->refresh();
266 273
267 } 274 }
268 else 275 else
269 { 276 {
270 qDebug("ViewManager::setActiveView: unable to find view" ); 277 qDebug("ViewManager::setActiveView: unable to find view" );
271 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; 278 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
272 } 279 }
273} 280}
274 281
275//US added another method with no parameter, since my moc compiler does not support default parameters. 282//US added another method with no parameter, since my moc compiler does not support default parameters.
276void ViewManager::refreshView() 283void ViewManager::refreshView()
277{ 284{
278 refreshView( QString::null ); 285 refreshView( QString::null );
279} 286}
280 287
281void ViewManager::refreshView( const QString &uid ) 288void ViewManager::refreshView( const QString &uid )
282{ 289{
283 if ( mActiveView ) 290 if ( mActiveView )
284 mActiveView->refresh( uid ); 291 mActiveView->refresh( uid );
285} 292}
286 293
287void ViewManager::editView() 294void ViewManager::editView()
288{ 295{
289 if ( !mActiveView ) 296 if ( !mActiveView )
290 return; 297 return;
291 298
292 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); 299 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
293 ViewConfigureWidget *wdg = 0; 300 ViewConfigureWidget *wdg = 0;
294 ViewConfigureDialog* dlg = 0; 301 ViewConfigureDialog* dlg = 0;
295 if ( factory ) { 302 if ( factory ) {
296 // Save the filters so the dialog has the latest set 303 // Save the filters so the dialog has the latest set
297 Filter::save( mCore->config(), "Filter", mFilterList ); 304 Filter::save( mCore->config(), "Filter", mFilterList );
298 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 305 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
299 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 306 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
300 } else { 307 } else {
301 qDebug("ViewManager::editView()::cannot find viewfactory "); 308 qDebug("ViewManager::editView()::cannot find viewfactory ");
302 return; 309 return;
303 } 310 }
304 if ( wdg ) { 311 if ( wdg ) {
305 dlg->setWidget( wdg ); 312 dlg->setWidget( wdg );
306 313
307#ifndef DESKTOP_VERSION 314#ifndef DESKTOP_VERSION
308 //dlg.setMaximumSize( 640, 480 ); 315 //dlg.setMaximumSize( 640, 480 );
309 //dlg->setGeometry( 40,40, 400, 300); 316 //dlg->setGeometry( 40,40, 400, 300);
310 dlg->showMaximized(); 317 dlg->showMaximized();
311#endif 318#endif
312 319
313 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 320 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
314 321
315 dlg->restoreSettings( mCore->config() ); 322 dlg->restoreSettings( mCore->config() );
316 323
317 if ( dlg->exec() ) { 324 if ( dlg->exec() ) {
318 dlg->saveSettings( mCore->config() ); 325 dlg->saveSettings( mCore->config() );
319 mActiveView->readConfig( mCore->config() ); 326 mActiveView->readConfig( mCore->config() );
320 327
321 // Set the proper filter in the view. By setting the combo 328 // Set the proper filter in the view. By setting the combo
322 // box, the activated slot will be called, which will push 329 // box, the activated slot will be called, which will push
323 // the filter to the view and refresh it. 330 // the filter to the view and refresh it.
324 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 331 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
325 mActionSelectFilter->setCurrentItem( 0 ); 332 mActionSelectFilter->setCurrentItem( 0 );
326 setActiveFilter( 0 ); 333 setActiveFilter( 0 );
327 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { 334 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) {
328 setActiveFilter( mActionSelectFilter->currentItem() ); 335 setActiveFilter( mActionSelectFilter->currentItem() );
329 } else { 336 } else {
330 uint pos = filterPosition( mActiveView->defaultFilterName() ); 337 uint pos = filterPosition( mActiveView->defaultFilterName() );
331 mActionSelectFilter->setCurrentItem( pos ); 338 mActionSelectFilter->setCurrentItem( pos );
332 setActiveFilter( pos ); 339 setActiveFilter( pos );
333 } 340 }
334 mCore->setSearchFields( mActiveView->fields() ); 341 mCore->setSearchFields( mActiveView->fields() );
335//US performance optimization. setActiveFilter calls also mActiveView->refresh() 342//US performance optimization. setActiveFilter calls also mActiveView->refresh()
336//US mActiveView->refresh(); 343//US mActiveView->refresh();
337 344
338 345
339 //US this is a bugfix, that we get notified if we change a views configuration 346 //US this is a bugfix, that we get notified if we change a views configuration
340 emit modified(); 347 emit modified();
341 348
342 } 349 }
343 350
344 } 351 }
345 delete dlg; 352 delete dlg;
346} 353}
347 354
348void ViewManager::deleteView() 355void ViewManager::deleteView()
349{ 356{
350 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) 357 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" )
351 .arg( mActiveView->caption() ); 358 .arg( mActiveView->caption() );
352 QString caption = i18n( "Confirm Delete" ); 359 QString caption = i18n( "Confirm Delete" );
353 360
354 361
355 if (QMessageBox::information( this, caption, 362 if (QMessageBox::information( this, caption,
356 text, 363 text,
357 i18n("Yes!"), i18n("No"), 0, 0 ) == 0) 364 i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
358 { 365 {
359 mViewNameList.remove( mActiveView->caption() ); 366 mViewNameList.remove( mActiveView->caption() );
360 367
361 // remove the view from the config file 368 // remove the view from the config file
362 KConfig *config = mCore->config(); 369 KConfig *config = mCore->config();
363 config->deleteGroup( mActiveView->caption() ); 370 config->deleteGroup( mActiveView->caption() );
364 371
365 mViewDict.remove( mActiveView->caption() ); 372 mViewDict.remove( mActiveView->caption() );
366 mActiveView = 0; 373 mActiveView = 0;
367 374
368 // we are in an invalid state now, but that should be fixed after 375 // we are in an invalid state now, but that should be fixed after
369 // we emit the signal 376 // we emit the signal
370 mActionSelectView->setItems( mViewNameList ); 377 mActionSelectView->setItems( mViewNameList );
371 if ( mViewNameList.count() > 0 ) { 378 if ( mViewNameList.count() > 0 ) {
372 mActionSelectView->setCurrentItem( 0 ); 379 mActionSelectView->setCurrentItem( 0 );
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index a18e87d..97c2275 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -1,152 +1,153 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef VIEWMANAGER_H 24#ifndef VIEWMANAGER_H
25#define VIEWMANAGER_H 25#define VIEWMANAGER_H
26 26
27#include <qwidget.h> 27#include <qwidget.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <kaddressbookview.h> 29#include <kaddressbookview.h>
30#include <qdict.h> 30#include <qdict.h>
31 31
32class KAction; 32class KAction;
33class KSelectAction; 33class KSelectAction;
34 34
35class KABCore; 35class KABCore;
36class QWidgetStack; 36class QWidgetStack;
37class QDropEvent; 37class QDropEvent;
38 38
39namespace KABC { class AddressBook; } 39namespace KABC { class AddressBook; }
40 40
41/** 41/**
42 The view manager manages the views and everything related to them. The 42 The view manager manages the views and everything related to them. The
43 manager will load the views at startup and display a view when told to 43 manager will load the views at startup and display a view when told to
44 make one active. 44 make one active.
45 45
46 The view manager will also create and manage all dialogs directly related to 46 The view manager will also create and manage all dialogs directly related to
47 views (ie: AddView, ConfigureView, DeleteView, etc). 47 views (ie: AddView, ConfigureView, DeleteView, etc).
48 */ 48 */
49class ViewManager : public QWidget 49class ViewManager : public QWidget
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 public: 52 public:
53 ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); 53 ViewManager( KABCore *core, QWidget *parent, const char *name = 0 );
54 ~ViewManager(); 54 ~ViewManager();
55 55
56 void restoreSettings(); 56 void restoreSettings();
57 void saveSettings(); 57 void saveSettings();
58 58
59 void unloadViews(); 59 void unloadViews();
60 KSelectAction * getFilterAction() { return mActionSelectFilter; } 60 KSelectAction * getFilterAction() { return mActionSelectFilter; }
61 61
62 QStringList selectedUids() const; 62 QStringList selectedUids() const;
63 QStringList selectedEmails() const; 63 QStringList selectedEmails() const;
64 KABC::Addressee::List selectedAddressees() const; 64 KABC::Addressee::List selectedAddressees() const;
65 void setListSelected(QStringList);
65 66
66 public slots: 67 public slots:
67 68
68//US void setSelected( const QString &uid = QString::null, bool selected = true ); 69//US void setSelected( const QString &uid = QString::null, bool selected = true );
69 void setSelected( const QString &uid, bool); 70 void setSelected( const QString &uid, bool);
70//US added another method with no parameter, since my moc compiler does not support default parameters. 71//US added another method with no parameter, since my moc compiler does not support default parameters.
71 void setSelected(); 72 void setSelected();
72 73
73 74
74 75
75//US added another method with no parameter, since my moc compiler does not support default parameters. 76//US added another method with no parameter, since my moc compiler does not support default parameters.
76 void refreshView(); 77 void refreshView();
77 void refreshView( const QString &uid); 78 void refreshView( const QString &uid);
78 79
79 void editView(); 80 void editView();
80 void deleteView(); 81 void deleteView();
81 void addView(); 82 void addView();
82 83
83 protected slots: 84 protected slots:
84 /** 85 /**
85 Called whenever the user drops something in the active view. 86 Called whenever the user drops something in the active view.
86 This method will try to decode what was dropped, and if it was 87 This method will try to decode what was dropped, and if it was
87 a valid addressee, add it to the addressbook. 88 a valid addressee, add it to the addressbook.
88 */ 89 */
89 void dropped( QDropEvent* ); 90 void dropped( QDropEvent* );
90 91
91 /** 92 /**
92 Called whenever the user attempts to start a drag in the view. 93 Called whenever the user attempts to start a drag in the view.
93 This method will convert all the selected addressees into text (vcard) 94 This method will convert all the selected addressees into text (vcard)
94 and create a drag object. 95 and create a drag object.
95 */ 96 */
96 void startDrag(); 97 void startDrag();
97 98
98 signals: 99 signals:
99 /** 100 /**
100 Emitted whenever the user selects an entry in the view. 101 Emitted whenever the user selects an entry in the view.
101 */ 102 */
102 void selected( const QString &uid ); 103 void selected( const QString &uid );
103 void deleteRequest( ); 104 void deleteRequest( );
104 105
105 /** 106 /**
106 Emitted whenever the user activates an entry in the view. 107 Emitted whenever the user activates an entry in the view.
107 */ 108 */
108 void executed( const QString &uid ); 109 void executed( const QString &uid );
109 110
110 /** 111 /**
111 Emitted whenever the address book is modified in some way. 112 Emitted whenever the address book is modified in some way.
112 */ 113 */
113 void modified(); 114 void modified();
114 115
115 /** 116 /**
116 Emitted whenever a url is dragged on a view. 117 Emitted whenever a url is dragged on a view.
117 */ 118 */
118 void urlDropped( const KURL& ); 119 void urlDropped( const KURL& );
119 120
120 private slots: 121 private slots:
121 void setActiveView( const QString &name ); 122 void setActiveView( const QString &name );
122 void setActiveFilter( int index ); 123 void setActiveFilter( int index );
123 void configureFilters(); 124 void configureFilters();
124 125
125 private: 126 private:
126 void createViewFactories(); 127 void createViewFactories();
127 QStringList filterNames() const; 128 QStringList filterNames() const;
128 int filterPosition( const QString &name ) const; 129 int filterPosition( const QString &name ) const;
129 QStringList viewNames() const; 130 QStringList viewNames() const;
130 int viewPosition( const QString &name ) const; 131 int viewPosition( const QString &name ) const;
131 void initActions(); 132 void initActions();
132 void initGUI(); 133 void initGUI();
133 134
134 KABCore *mCore; 135 KABCore *mCore;
135 136
136 Filter mCurrentFilter; 137 Filter mCurrentFilter;
137 Filter::List mFilterList; 138 Filter::List mFilterList;
138 139
139 QDict<KAddressBookView> mViewDict; 140 QDict<KAddressBookView> mViewDict;
140 QDict<ViewFactory> mViewFactoryDict; 141 QDict<ViewFactory> mViewFactoryDict;
141 QStringList mViewNameList; 142 QStringList mViewNameList;
142 143
143 QWidgetStack *mViewWidgetStack; 144 QWidgetStack *mViewWidgetStack;
144 KAddressBookView *mActiveView; 145 KAddressBookView *mActiveView;
145 146
146 KAction *mActionDeleteView; 147 KAction *mActionDeleteView;
147 KSelectAction *mActionSelectFilter; 148 KSelectAction *mActionSelectFilter;
148 KSelectAction *mActionSelectView; 149 KSelectAction *mActionSelectView;
149 150
150}; 151};
151 152
152#endif 153#endif
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 66a3f0b..0847b64 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -1,364 +1,364 @@
1// $Id$ 1// $Id$
2 2
3#include <qvbox.h> 3#include <qvbox.h>
4#include <qlistbox.h> 4#include <qlistbox.h>
5#include <qwidget.h> 5#include <qwidget.h>
6#include <qfile.h> 6#include <qfile.h>
7#include <qimage.h> 7#include <qimage.h>
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qdragobject.h> 10#include <qdragobject.h>
11#include <qevent.h> 11#include <qevent.h>
12#include <qurl.h> 12#include <qurl.h>
13#include <qpixmap.h> 13#include <qpixmap.h>
14 14
15#include <kabc/addressbook.h> 15#include <kabc/addressbook.h>
16#include <kapplication.h> 16#include <kapplication.h>
17#include <kconfig.h> 17#include <kconfig.h>
18#include <kcolorbutton.h> 18#include <kcolorbutton.h>
19#include <kdebug.h> 19#include <kdebug.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <kiconloader.h> 21#include <kiconloader.h>
22#include <klineedit.h> 22#include <klineedit.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kmessagebox.h> 24#include <kmessagebox.h>
25#include <kurl.h> 25#include <kurl.h>
26#include <kurlrequester.h> 26#include <kurlrequester.h>
27 27
28//US#include "configuretableviewdialog.h" 28//US#include "configuretableviewdialog.h"
29#include "contactlistview.h" 29#include "contactlistview.h"
30#include "kabprefs.h" 30#include "kabprefs.h"
31#include "undocmds.h" 31#include "undocmds.h"
32#include "viewmanager.h" 32#include "viewmanager.h"
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35 35
36 36
37#include "kaddressbooktableview.h" 37#include "kaddressbooktableview.h"
38 38
39 39
40KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, 40KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
41 QWidget *parent, const char *name ) 41 QWidget *parent, const char *name )
42 : KAddressBookView( ab, parent, name ) 42 : KAddressBookView( ab, parent, name )
43{ 43{
44 mainLayout = new QVBoxLayout( viewWidget(), 2 ); 44 mainLayout = new QVBoxLayout( viewWidget(), 2 );
45 45
46 // The list view will be created when the config is read. 46 // The list view will be created when the config is read.
47 mListView = 0; 47 mListView = 0;
48} 48}
49 49
50KAddressBookTableView::~KAddressBookTableView() 50KAddressBookTableView::~KAddressBookTableView()
51{ 51{
52} 52}
53 53
54void KAddressBookTableView::reconstructListView() 54void KAddressBookTableView::reconstructListView()
55{ 55{
56 if (mListView) 56 if (mListView)
57 { 57 {
58 disconnect(mListView, SIGNAL(selectionChanged()), 58 disconnect(mListView, SIGNAL(selectionChanged()),
59 this, SLOT(addresseeSelected())); 59 this, SLOT(addresseeSelected()));
60 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 60 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
61 this, SLOT(addresseeExecuted(QListViewItem*))); 61 this, SLOT(addresseeExecuted(QListViewItem*)));
62 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 62 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
63 this, SLOT(addresseeExecuted(QListViewItem*))); 63 this, SLOT(addresseeExecuted(QListViewItem*)));
64 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 64 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
65 SIGNAL(startDrag())); 65 SIGNAL(startDrag()));
66 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 66 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
67 this, SLOT(addresseeExecuted(QListViewItem*))); 67 this, SLOT(addresseeExecuted(QListViewItem*)));
68 68
69 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 69 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
70 SIGNAL(dropped(QDropEvent*))); 70 SIGNAL(dropped(QDropEvent*)));
71 delete mListView; 71 delete mListView;
72 } 72 }
73 73
74 mListView = new ContactListView( this, addressBook(), viewWidget() ); 74 mListView = new ContactListView( this, addressBook(), viewWidget() );
75 75
76 // Add the columns 76 // Add the columns
77 KABC::Field::List fieldList = fields(); 77 KABC::Field::List fieldList = fields();
78 KABC::Field::List::ConstIterator it; 78 KABC::Field::List::ConstIterator it;
79 79
80 int c = 0; 80 int c = 0;
81 for( it = fieldList.begin(); it != fieldList.end(); ++it ) { 81 for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
82 mListView->addColumn( (*it)->label() ); 82 mListView->addColumn( (*it)->label() );
83 mListView->setColumnWidthMode(c++, QListView::Manual); 83 mListView->setColumnWidthMode(c++, QListView::Manual);
84//US 84//US
85 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); 85 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
86 } 86 }
87 87
88 connect(mListView, SIGNAL(selectionChanged()), 88 connect(mListView, SIGNAL(selectionChanged()),
89 this, SLOT(addresseeSelected())); 89 this, SLOT(addresseeSelected()));
90 connect(mListView, SIGNAL(startAddresseeDrag()), this, 90 connect(mListView, SIGNAL(startAddresseeDrag()), this,
91 SIGNAL(startDrag())); 91 SIGNAL(startDrag()));
92 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 92 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
93 SIGNAL(dropped(QDropEvent*))); 93 SIGNAL(dropped(QDropEvent*)));
94 94
95 if (KABPrefs::instance()->mHonorSingleClick) 95 if (KABPrefs::instance()->mHonorSingleClick)
96 connect(mListView, SIGNAL(executed(QListViewItem*)), 96 connect(mListView, SIGNAL(executed(QListViewItem*)),
97 this, SLOT(addresseeExecuted(QListViewItem*))); 97 this, SLOT(addresseeExecuted(QListViewItem*)));
98 else 98 else
99 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 99 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
100 this, SLOT(addresseeExecuted(QListViewItem*))); 100 this, SLOT(addresseeExecuted(QListViewItem*)));
101 connect(mListView, SIGNAL(returnPressed(QListViewItem*)), 101 connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
102 this, SLOT(addresseeExecuted(QListViewItem*))); 102 this, SLOT(addresseeExecuted(QListViewItem*)));
103 connect(mListView, SIGNAL(signalDelete()), 103 connect(mListView, SIGNAL(signalDelete()),
104 this, SLOT(addresseeDeleted())); 104 this, SLOT(addresseeDeleted()));
105 105
106//US performceimprovement. Refresh is done from the outside 106//US performceimprovement. Refresh is done from the outside
107//US refresh(); 107//US refresh();
108 108
109 mListView->setSorting( 0, true ); 109 mListView->setSorting( 0, true );
110 mainLayout->addWidget( mListView ); 110 mainLayout->addWidget( mListView );
111 mainLayout->activate(); 111 mainLayout->activate();
112 mListView->show(); 112 mListView->show();
113} 113}
114 114
115void KAddressBookTableView::writeConfig(KConfig *config) 115void KAddressBookTableView::writeConfig(KConfig *config)
116{ 116{
117 KAddressBookView::writeConfig(config); 117 KAddressBookView::writeConfig(config);
118 118
119 mListView->saveLayout(config, config->group()); 119 mListView->saveLayout(config, config->group());
120} 120}
121 121
122void KAddressBookTableView::readConfig(KConfig *config) 122void KAddressBookTableView::readConfig(KConfig *config)
123{ 123{
124 KAddressBookView::readConfig( config ); 124 KAddressBookView::readConfig( config );
125 // The config could have changed the fields, so we need to reconstruct
126 // the listview.
127 reconstructListView();
125 128
126 // costum colors? 129 // costum colors?
127 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 130 if ( config->readBoolEntry( "EnableCustomColors", false ) )
128 { 131 {
129 QPalette p( mListView->palette() ); 132 QPalette p( mListView->palette() );
130 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 133 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
131 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 134 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
132 c = p.color(QPalette::Normal, QColorGroup::Text ); 135 c = p.color(QPalette::Normal, QColorGroup::Text );
133 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); 136 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
134 c = p.color(QPalette::Normal, QColorGroup::Button ); 137 c = p.color(QPalette::Normal, QColorGroup::Button );
135 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); 138 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
136 c = p.color(QPalette::Normal, QColorGroup::ButtonText ); 139 c = p.color(QPalette::Normal, QColorGroup::ButtonText );
137 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); 140 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
138 c = p.color(QPalette::Normal, QColorGroup::Highlight ); 141 c = p.color(QPalette::Normal, QColorGroup::Highlight );
139 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); 142 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
140 c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); 143 c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
141 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); 144 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
142 c = p.color(QPalette::Normal, QColorGroup::Base ); 145 c = p.color(QPalette::Normal, QColorGroup::Base );
143 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) ); 146 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "AlternatingBackgroundColor", &c ) );
144 mListView->viewport()->setPalette( p ); 147 mListView->viewport()->setPalette( p );
145 } 148 }
146 else 149 else
147 { 150 {
148 // needed if turned off during a session. 151 // needed if turned off during a session.
149 mListView->viewport()->setPalette( mListView->palette() ); 152 mListView->viewport()->setPalette( mListView->palette() );
150 } 153 }
151 154
152 //custom fonts? 155 //custom fonts?
153 QFont f( font() ); 156 QFont f( font() );
154 if ( config->readBoolEntry( "EnableCustomFonts", false ) ) 157 if ( config->readBoolEntry( "EnableCustomFonts", false ) )
155 { 158 {
156 // mListView->setFont( config->readFontEntry( "TextFont", &f) ); 159 // mListView->setFont( config->readFontEntry( "TextFont", &f) );
157 f.setBold( true ); 160 f.setBold( true );
158 // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); 161 // mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
159 } 162 }
160 else 163 else
161 { 164 {
162 // mListView->setFont( f ); 165 // mListView->setFont( f );
163 f.setBold( true ); 166 f.setBold( true );
164 // mListView->setHeaderFont( f ); 167 // mListView->setHeaderFont( f );
165 } 168 }
166 169
167 170
168 171
169 172
170 // The config could have changed the fields, so we need to reconstruct
171 // the listview.
172 reconstructListView();
173 173
174 // Set the list view options 174 // Set the list view options
175 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", 175 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground",
176 true)); 176 true));
177 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); 177 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false));
178 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); 178 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true));
179 179
180 if (config->readBoolEntry("Background", false)) 180 if (config->readBoolEntry("Background", false))
181 mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); 181 mListView->setBackgroundPixmap(config->readEntry("BackgroundName"));
182 182
183 // Restore the layout of the listview 183 // Restore the layout of the listview
184 mListView->restoreLayout(config, config->group()); 184 mListView->restoreLayout(config, config->group());
185} 185}
186 186
187void KAddressBookTableView::refresh(QString uid) 187void KAddressBookTableView::refresh(QString uid)
188{ 188{
189 // For now just repopulate. In reality this method should 189 // For now just repopulate. In reality this method should
190 // check the value of uid, and if valid iterate through 190 // check the value of uid, and if valid iterate through
191 // the listview to find the entry, then tell it to refresh. 191 // the listview to find the entry, then tell it to refresh.
192 192
193 if (uid.isNull()) { 193 if (uid.isNull()) {
194 // Clear the list view 194 // Clear the list view
195 QString currentUID, nextUID; 195 QString currentUID, nextUID;
196#ifndef KAB_EMBEDDED 196#ifndef KAB_EMBEDDED
197 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); 197 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() );
198#else //KAB_EMBEDDED 198#else //KAB_EMBEDDED
199 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); 199 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() );
200#endif //KAB_EMBEDDED 200#endif //KAB_EMBEDDED
201 201
202 if ( currentItem ) { 202 if ( currentItem ) {
203#ifndef KAB_EMBEDDED 203#ifndef KAB_EMBEDDED
204 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); 204 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() );
205#else //KAB_EMBEDDED 205#else //KAB_EMBEDDED
206 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); 206 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() );
207#endif //KAB_EMBEDDED 207#endif //KAB_EMBEDDED
208 if ( nextItem ) 208 if ( nextItem )
209 nextUID = nextItem->addressee().uid(); 209 nextUID = nextItem->addressee().uid();
210 currentUID = currentItem->addressee().uid(); 210 currentUID = currentItem->addressee().uid();
211 } 211 }
212 212
213 mListView->clear(); 213 mListView->clear();
214 214
215 currentItem = 0; 215 currentItem = 0;
216 KABC::Addressee::List addresseeList = addressees(); 216 KABC::Addressee::List addresseeList = addressees();
217 KABC::Addressee::List::Iterator it; 217 KABC::Addressee::List::Iterator it;
218 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 218 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
219 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 219 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
220 if ( (*it).uid() == currentUID ) 220 if ( (*it).uid() == currentUID )
221 currentItem = item; 221 currentItem = item;
222 else if ( (*it).uid() == nextUID && !currentItem ) 222 else if ( (*it).uid() == nextUID && !currentItem )
223 currentItem = item; 223 currentItem = item;
224 } 224 }
225 225
226 // Sometimes the background pixmap gets messed up when we add lots 226 // Sometimes the background pixmap gets messed up when we add lots
227 // of items. 227 // of items.
228 mListView->repaint(); 228 mListView->repaint();
229 229
230 if ( currentItem ) { 230 if ( currentItem ) {
231 mListView->setCurrentItem( currentItem ); 231 mListView->setCurrentItem( currentItem );
232 mListView->ensureItemVisible( currentItem ); 232 mListView->ensureItemVisible( currentItem );
233 } 233 }
234 } else { 234 } else {
235 // Only need to update on entry. Iterate through and try to find it 235 // Only need to update on entry. Iterate through and try to find it
236 ContactListViewItem *ceItem; 236 ContactListViewItem *ceItem;
237 QListViewItemIterator it( mListView ); 237 QListViewItemIterator it( mListView );
238 while ( it.current() ) { 238 while ( it.current() ) {
239#ifndef KAB_EMBEDDED 239#ifndef KAB_EMBEDDED
240 ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); 240 ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
241#else //KAB_EMBEDDED 241#else //KAB_EMBEDDED
242 ceItem = (ContactListViewItem*)( it.current() ); 242 ceItem = (ContactListViewItem*)( it.current() );
243#endif //KAB_EMBEDDED 243#endif //KAB_EMBEDDED
244 244
245 if ( ceItem && ceItem->addressee().uid() == uid ) { 245 if ( ceItem && ceItem->addressee().uid() == uid ) {
246 ceItem->refresh(); 246 ceItem->refresh();
247 return; 247 return;
248 } 248 }
249 ++it; 249 ++it;
250 } 250 }
251 251
252 refresh( QString::null ); 252 refresh( QString::null );
253 } 253 }
254} 254}
255 255
256QStringList KAddressBookTableView::selectedUids() 256QStringList KAddressBookTableView::selectedUids()
257{ 257{
258 QStringList uidList; 258 QStringList uidList;
259 QListViewItem *item; 259 QListViewItem *item;
260 ContactListViewItem *ceItem; 260 ContactListViewItem *ceItem;
261 261
262 for(item = mListView->firstChild(); item; item = item->itemBelow()) 262 for(item = mListView->firstChild(); item; item = item->itemBelow())
263 { 263 {
264 if (mListView->isSelected( item )) 264 if (mListView->isSelected( item ))
265 { 265 {
266#ifndef KAB_EMBEDDED 266#ifndef KAB_EMBEDDED
267 ceItem = dynamic_cast<ContactListViewItem*>(item); 267 ceItem = dynamic_cast<ContactListViewItem*>(item);
268#else //KAB_EMBEDDED 268#else //KAB_EMBEDDED
269 ceItem = (ContactListViewItem*)(item); 269 ceItem = (ContactListViewItem*)(item);
270#endif //KAB_EMBEDDED 270#endif //KAB_EMBEDDED
271 271
272 if (ceItem != 0L) 272 if (ceItem != 0L)
273 uidList << ceItem->addressee().uid(); 273 uidList << ceItem->addressee().uid();
274 } 274 }
275 } 275 }
276 if ( uidList.count() == 0 ) 276 if ( uidList.count() == 0 )
277 if ( mListView->currentItem() ) { 277 if ( mListView->currentItem() ) {
278 ceItem = (ContactListViewItem*)(mListView->currentItem()) ; 278 ceItem = (ContactListViewItem*)(mListView->currentItem()) ;
279 uidList << ceItem->addressee().uid(); 279 uidList << ceItem->addressee().uid();
280 } 280 }
281 281
282 return uidList; 282 return uidList;
283} 283}
284 284
285void KAddressBookTableView::setSelected(QString uid, bool selected) 285void KAddressBookTableView::setSelected(QString uid, bool selected)
286{ 286{
287 QListViewItem *item; 287 QListViewItem *item;
288 ContactListViewItem *ceItem; 288 ContactListViewItem *ceItem;
289 289
290 if (uid.isNull()) 290 if (uid.isNull())
291 { 291 {
292 mListView->selectAll(selected); 292 mListView->selectAll(selected);
293 } 293 }
294 else 294 else
295 { 295 {
296 for(item = mListView->firstChild(); item; item = item->itemBelow()) 296 for(item = mListView->firstChild(); item; item = item->itemBelow())
297 { 297 {
298#ifndef KAB_EMBEDDED 298#ifndef KAB_EMBEDDED
299 ceItem = dynamic_cast<ContactListViewItem*>(item); 299 ceItem = dynamic_cast<ContactListViewItem*>(item);
300#else //KAB_EMBEDDED 300#else //KAB_EMBEDDED
301 ceItem = (ContactListViewItem*)(item); 301 ceItem = (ContactListViewItem*)(item);
302#endif //KAB_EMBEDDED 302#endif //KAB_EMBEDDED
303 303
304 304
305 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) 305 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid))
306 { 306 {
307 mListView->setSelected(item, selected); 307 mListView->setSelected(item, selected);
308 308
309 if (selected) 309 if (selected)
310 mListView->ensureItemVisible(item); 310 mListView->ensureItemVisible(item);
311 } 311 }
312 } 312 }
313 } 313 }
314} 314}
315 315
316void KAddressBookTableView::addresseeSelected() 316void KAddressBookTableView::addresseeSelected()
317{ 317{
318 // We need to try to find the first selected item. This might not be the 318 // We need to try to find the first selected item. This might not be the
319 // last selected item, but when QListView is in multiselection mode, 319 // last selected item, but when QListView is in multiselection mode,
320 // there is no way to figure out which one was 320 // there is no way to figure out which one was
321 // selected last. 321 // selected last.
322 QListViewItem *item; 322 QListViewItem *item;
323 bool found =false; 323 bool found =false;
324 for (item = mListView->firstChild(); item && !found; 324 for (item = mListView->firstChild(); item && !found;
325 item = item->nextSibling()) 325 item = item->nextSibling())
326 { 326 {
327 if (item->isSelected()) 327 if (item->isSelected())
328 { 328 {
329 found = true; 329 found = true;
330#ifndef KAB_EMBEDDED 330#ifndef KAB_EMBEDDED
331 ContactListViewItem *ceItem 331 ContactListViewItem *ceItem
332 = dynamic_cast<ContactListViewItem*>(item); 332 = dynamic_cast<ContactListViewItem*>(item);
333#else //KAB_EMBEDDED 333#else //KAB_EMBEDDED
334 ContactListViewItem *ceItem 334 ContactListViewItem *ceItem
335 = (ContactListViewItem*)(item); 335 = (ContactListViewItem*)(item);
336#endif //KAB_EMBEDDED 336#endif //KAB_EMBEDDED
337 337
338 if ( ceItem ) emit selected(ceItem->addressee().uid()); 338 if ( ceItem ) emit selected(ceItem->addressee().uid());
339 } 339 }
340 } 340 }
341 341
342 if (!found) 342 if (!found)
343 emit selected(QString::null); 343 emit selected(QString::null);
344} 344}
345 345
346void KAddressBookTableView::addresseeExecuted(QListViewItem *item) 346void KAddressBookTableView::addresseeExecuted(QListViewItem *item)
347{ 347{
348 if (item) 348 if (item)
349 { 349 {
350#ifndef KAB_EMBEDDED 350#ifndef KAB_EMBEDDED
351 ContactListViewItem *ceItem 351 ContactListViewItem *ceItem
352 = dynamic_cast<ContactListViewItem*>(item); 352 = dynamic_cast<ContactListViewItem*>(item);
353#else //KAB_EMBEDDED 353#else //KAB_EMBEDDED
354 ContactListViewItem *ceItem 354 ContactListViewItem *ceItem
355 = (ContactListViewItem*)(item); 355 = (ContactListViewItem*)(item);
356#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
357 357
358 if (ceItem) 358 if (ceItem)
359 { 359 {
360 emit executed(ceItem->addressee().uid()); 360 emit executed(ceItem->addressee().uid());
361 } 361 }
362 } 362 }
363 else 363 else
364 { 364 {