summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseedialog.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index b3429e3..648e780 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -43,48 +43,49 @@ AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
43 mAddressee( addressee ) 43 mAddressee( addressee )
44{ 44{
45 QString name = addressee.familyName()+", "+ addressee.givenName(); 45 QString name = addressee.familyName()+", "+ addressee.givenName();
46 if ( name.length() == 2 ) 46 if ( name.length() == 2 )
47 name = addressee.organization(); 47 name = addressee.organization();
48 setText( Name,name); 48 setText( Name,name);
49 setText( Email, addressee.preferredEmail() ); 49 setText( Email, addressee.preferredEmail() );
50} 50}
51 51
52QString AddresseeItem::key( int column, bool ) const 52QString AddresseeItem::key( int column, bool ) const
53{ 53{
54 54
55 if (column == Email) { 55 if (column == Email) {
56 QString value = text(Email); 56 QString value = text(Email);
57 int val = value.findRev("@"); 57 int val = value.findRev("@");
58 return value.mid( val) + value.left( val ); 58 return value.mid( val) + value.left( val );
59 } 59 }
60 return text(column).lower(); 60 return text(column).lower();
61} 61}
62 62
63AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : 63AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
64 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), 64 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
65 Ok|Cancel, No, parent ), mMultiple( multiple ) 65 Ok|Cancel, No, parent ), mMultiple( multiple )
66{ 66{
67 qDebug("NEW AddresseeDialog ");
67 QWidget *topWidget = plainPage(); 68 QWidget *topWidget = plainPage();
68 69
69 QBoxLayout *topLayout = new QHBoxLayout( topWidget ); 70 QBoxLayout *topLayout = new QHBoxLayout( topWidget );
70 71
71 72
72 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); 73 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget);
73 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 74 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
74 75
75 topLayout->addWidget(mMiniSplitter ); 76 topLayout->addWidget(mMiniSplitter );
76 77
77 QWidget *listWidget = new QWidget( mMiniSplitter ); 78 QWidget *listWidget = new QWidget( mMiniSplitter );
78 79
79 QBoxLayout *listLayout = new QVBoxLayout (listWidget) ; 80 QBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
80 //topLayout->addLayout( listLayout ); 81 //topLayout->addLayout( listLayout );
81 82
82 mAddresseeList = new KListView( listWidget ); 83 mAddresseeList = new KListView( listWidget );
83 mAddresseeList->addColumn( i18n("Name") ); 84 mAddresseeList->addColumn( i18n("Name") );
84 mAddresseeList->addColumn( i18n("Email") ); 85 mAddresseeList->addColumn( i18n("Email") );
85 mAddresseeList->setAllColumnsShowFocus( true ); 86 mAddresseeList->setAllColumnsShowFocus( true );
86 mAddresseeList->setFullWidth( true ); 87 mAddresseeList->setFullWidth( true );
87 listLayout->addWidget( mAddresseeList ); 88 listLayout->addWidget( mAddresseeList );
88 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), 89 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
89 SLOT( slotOk() ) ); 90 SLOT( slotOk() ) );
90 91
@@ -116,48 +117,49 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
116 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); 117 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
117 118
118 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), 119 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
119 SLOT( addSelected( QListViewItem * ) ) ); 120 SLOT( addSelected( QListViewItem * ) ) );
120 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), 121 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
121 SLOT( selectNextItem( QListViewItem * ) ) ); 122 SLOT( selectNextItem( QListViewItem * ) ) );
122 123
123 } 124 }
124 125
125 mAddressBook = StdAddressBook::self( true ); 126 mAddressBook = StdAddressBook::self( true );
126 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), 127 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
127 SLOT( addressBookChanged() ) ); 128 SLOT( addressBookChanged() ) );
128 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), 129 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
129 SLOT( addressBookChanged() ) ); 130 SLOT( addressBookChanged() ) );
130 131
131 loadAddressBook(); 132 loadAddressBook();
132 QValueList<int> splitterSize; 133 QValueList<int> splitterSize;
133 splitterSize.append( ( width() / 5 ) * 3 ); 134 splitterSize.append( ( width() / 5 ) * 3 );
134 splitterSize.append( ( width() / 5 ) *2 ); 135 splitterSize.append( ( width() / 5 ) *2 );
135 mMiniSplitter->setSizes( splitterSize ); 136 mMiniSplitter->setSizes( splitterSize );
136} 137}
137 138
138AddresseeDialog::~AddresseeDialog() 139AddresseeDialog::~AddresseeDialog()
139{ 140{
141 qDebug("DELETE AddresseeDialog ");
140} 142}
141 143
142void AddresseeDialog::loadAddressBook() 144void AddresseeDialog::loadAddressBook()
143{ 145{
144 mAddresseeList->clear(); 146 mAddresseeList->clear();
145 mItemDict.clear(); 147 mItemDict.clear();
146 if ( mAddresseeEdit->text().isEmpty() ) { 148 if ( mAddresseeEdit->text().isEmpty() ) {
147 AddressBook::Iterator it; 149 AddressBook::Iterator it;
148 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 150 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
149 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 151 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
150 continue; 152 continue;
151 new AddresseeItem( mAddresseeList, (*it) ); 153 new AddresseeItem( mAddresseeList, (*it) );
152 } 154 }
153 return; 155 return;
154 } 156 }
155 //mAddresseeEdit->completionObject()->clear(); 157 //mAddresseeEdit->completionObject()->clear();
156 QRegExp re; 158 QRegExp re;
157 re.setWildcard(true); // most people understand these better. 159 re.setWildcard(true); // most people understand these better.
158 re.setCaseSensitive(false); 160 re.setCaseSensitive(false);
159 re.setPattern( "*"+ mAddresseeEdit->text() + "*"); 161 re.setPattern( "*"+ mAddresseeEdit->text() + "*");
160 162
161 AddressBook::Iterator it; 163 AddressBook::Iterator it;
162 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 164 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
163 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 165 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )