summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/jumpbuttonbar.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp
index ee5b44e..184d516 100644
--- a/kaddressbook/jumpbuttonbar.cpp
+++ b/kaddressbook/jumpbuttonbar.cpp
@@ -96,65 +96,66 @@ QSizePolicy JumpButtonBar::sizePolicy() const
96} 96}
97 97
98void JumpButtonBar::letterClicked() 98void JumpButtonBar::letterClicked()
99{ 99{
100 JumpButton *button = (JumpButton*)sender(); 100 JumpButton *button = (JumpButton*)sender();
101 QString character = button->character(); 101 QString character = button->character();
102 if ( !character.isNull() ) 102 if ( !character.isNull() )
103 emit jumpToLetter( character ); 103 emit jumpToLetter( character );
104} 104}
105 105
106void JumpButtonBar::recreateButtons() 106void JumpButtonBar::recreateButtons()
107{ 107{
108 // the easiest way to remove all buttons ;) 108 // the easiest way to remove all buttons ;)
109 //mButtons.setAutoDelete( true ); 109 //mButtons.setAutoDelete( true );
110 //mButtons.clear(); 110 //mButtons.clear();
111 //mButtons.setAutoDelete( false ); 111 //mButtons.setAutoDelete( false );
112 mCharacters.clear(); 112 mCharacters.clear();
113 113
114 QString character; 114 QString character;
115 115
116 KABC::AddressBook *ab = mCore->addressBook(); 116 KABC::AddressBook *ab = mCore->addressBook();
117 KABC::AddressBook::Iterator it; 117 KABC::AddressBook::Iterator it;
118 KABC::Field *field = mCore->currentSearchField(); 118 KABC::Field *field = mCore->currentSearchField();
119 if ( field ) { 119 if ( field ) {
120 setEnabled( true ); 120 setEnabled( true );
121 } else { 121 } else {
122 setEnabled( false ); 122 setEnabled( false );
123 return; 123 return;
124 } 124 }
125 for ( it = ab->begin(); it != ab->end(); ++it ) { 125 for ( it = ab->begin(); it != ab->end(); ++it ) {
126 if ( !field->value( *it ).isEmpty() ) 126 if ( !field->value( *it ).isEmpty() )
127 character = field->value( *it )[ 0 ].lower(); 127 character = field->value( *it )[ 0 ].lower();
128 if ( !character.isEmpty() && !mCharacters.contains( character ) ) 128 if ( character != "!" )
129 if ( !character.isEmpty() && !mCharacters.contains( character ) )
129 mCharacters.append( character ); 130 mCharacters.append( character );
130 } 131 }
131 if ( mCharacters.count() == 0 ) { 132 if ( mCharacters.count() == 0 ) {
132 setEnabled( false ); 133 setEnabled( false );
133 return; 134 return;
134 } 135 }
135 136
136 int maxRows = mCharacters.count() / 2; // we use 2 columns 137 int maxRows = mCharacters.count() / 2; // we use 2 columns
137 if ( mCharacters.count() % 2 ) 138 if ( mCharacters.count() % 2 )
138 maxRows++; 139 maxRows++;
139 int fixwid = 20; 140 int fixwid = 20;
140 sortListLocaleAware( mCharacters ); 141 sortListLocaleAware( mCharacters );
141 bool skip2 = false; 142 bool skip2 = false;
142 int skipcount = 0; 143 int skipcount = 0;
143 int maxHei = 25; 144 int maxHei = 25;
144 if ( QApplication::desktop()->width() < 480 && mCharacters.count() > 13) { 145 if ( QApplication::desktop()->width() < 480 && mCharacters.count() > 13) {
145 skipcount = mCharacters.count()-13; 146 skipcount = mCharacters.count()-13;
146 maxHei = (QApplication::desktop()->height()-65)/13; 147 maxHei = (QApplication::desktop()->height()-65)/13;
147 } 148 }
148 else { 149 else {
149 fixwid = 30; 150 fixwid = 30;
150 if ( mCharacters.count() > 20 ) 151 if ( mCharacters.count() > 20 )
151 skipcount = mCharacters.count()- 20; 152 skipcount = mCharacters.count()- 20;
152 maxHei = (QApplication::desktop()->height()-120)/(mCharacters.count()-skipcount); 153 maxHei = (QApplication::desktop()->height()-120)/(mCharacters.count()-skipcount);
153 154
154 } 155 }
155 maxRows = 28; 156 maxRows = 28;
156 bool skipcurrent = false; 157 bool skipcurrent = false;
157 bool state = isUpdatesEnabled(); 158 bool state = isUpdatesEnabled();
158 setUpdatesEnabled( false ); 159 setUpdatesEnabled( false );
159 //qDebug("cc %d ",mCharacters.count() ); 160 //qDebug("cc %d ",mCharacters.count() );
160 JumpButton *button; 161 JumpButton *button;