summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-12-05 11:14:32 (UTC)
committer zautrix <zautrix>2004-12-05 11:14:32 (UTC)
commit196365e533c6fd1a8f47aa9579763ef5afcebcda (patch) (unidiff)
tree3784f0be50b790d9386db1e4ebd29d44317db026 /kaddressbook
parente4e75984b6cb581d87d436cb6c5140eb57dbdc51 (diff)
downloadkdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.zip
kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.gz
kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.bz2
layout bugfixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp2
-rw-r--r--kaddressbook/xxportselectdialog.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index ad43970..23b091c 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -96,193 +96,193 @@ void DynamicTip::maybeTip( const QPoint &pos )
96 96
97 QString notes = a.note().stripWhiteSpace(); 97 QString notes = a.note().stripWhiteSpace();
98 if ( !notes.isEmpty() ) { 98 if ( !notes.isEmpty() ) {
99 notes += '\n'; 99 notes += '\n';
100 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); 100 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel());
101 QFontMetrics fm( font() ); 101 QFontMetrics fm( font() );
102 102
103 // Begin word wrap code based on QMultiLineEdit code 103 // Begin word wrap code based on QMultiLineEdit code
104 int i = 0; 104 int i = 0;
105 bool doBreak = false; 105 bool doBreak = false;
106 int linew = 0; 106 int linew = 0;
107 int lastSpace = -1; 107 int lastSpace = -1;
108 int a = 0; 108 int a = 0;
109 int lastw = 0; 109 int lastw = 0;
110 110
111 while ( i < int(notes.length()) ) { 111 while ( i < int(notes.length()) ) {
112 doBreak = FALSE; 112 doBreak = FALSE;
113 if ( notes[i] != '\n' ) 113 if ( notes[i] != '\n' )
114 linew += fm.width( notes[i] ); 114 linew += fm.width( notes[i] );
115 115
116 if ( lastSpace >= a && notes[i] != '\n' ) 116 if ( lastSpace >= a && notes[i] != '\n' )
117 if (linew >= parentWidget()->width()) { 117 if (linew >= parentWidget()->width()) {
118 doBreak = TRUE; 118 doBreak = TRUE;
119 if ( lastSpace > a ) { 119 if ( lastSpace > a ) {
120 i = lastSpace; 120 i = lastSpace;
121 linew = lastw; 121 linew = lastw;
122 } 122 }
123 else 123 else
124 i = QMAX( a, i-1 ); 124 i = QMAX( a, i-1 );
125 } 125 }
126 126
127 if ( notes[i] == '\n' || doBreak ) { 127 if ( notes[i] == '\n' || doBreak ) {
128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; 128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n";
129 129
130 a = i + 1; 130 a = i + 1;
131 lastSpace = a; 131 lastSpace = a;
132 linew = 0; 132 linew = 0;
133 } 133 }
134 134
135 if ( notes[i].isSpace() ) { 135 if ( notes[i].isSpace() ) {
136 lastSpace = i; 136 lastSpace = i;
137 lastw = linew; 137 lastw = linew;
138 } 138 }
139 139
140 if ( lastSpace <= a ) { 140 if ( lastSpace <= a ) {
141 lastw = linew; 141 lastw = linew;
142 } 142 }
143 143
144 ++i; 144 ++i;
145 } 145 }
146 } 146 }
147 147
148 tip( r, s ); 148 tip( r, s );
149 } 149 }
150 else 150 else
151 hide(); 151 hide();
152 ishidden = !ishidden; 152 ishidden = !ishidden;
153 153
154} 154}
155 155
156/////////////////////////// 156///////////////////////////
157// ContactListViewItem Methods 157// ContactListViewItem Methods
158 158
159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
160 ContactListView *parent, 160 ContactListView *parent,
161 KABC::AddressBook *doc, 161 KABC::AddressBook *doc,
162 const KABC::Field::List &fields ) 162 const KABC::Field::List &fields )
163 : KListViewItem(parent), mAddressee(a), mFields( fields ), 163 : KListViewItem(parent), mAddressee(a), mFields( fields ),
164 parentListView( parent ), mDocument(doc) 164 parentListView( parent ), mDocument(doc)
165{ 165{
166 refresh(); 166 refresh();
167} 167}
168 168
169QString ContactListViewItem::key(int column, bool ascending) const 169QString ContactListViewItem::key(int column, bool ascending) const
170{ 170{
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 int lan = KGlobal::locale()->language(); 172 int lan = KGlobal::locale()->language();
173 //qDebug("language %d ", lan); 173 //qDebug("language %d ", lan);
174 if ( lan == 1 ) { //GERMAN 174 if ( lan == 1 ) { //GERMAN
175 QString ret = QListViewItem::key(column, ascending).lower().utf8(); 175 QString ret = QListViewItem::key(column, ascending).lower().utf8();
176 int start = -1; 176 int start = -1;
177 while ( (start = ret.find( 'ä', start+1)) > 0 ) { 177 while ( (start = ret.find( 'ä', start+1)) > 0 ) {
178 ret.at(start-1) = 'a'; 178 ret.at(start-1) = 'a';
179 } 179 }
180 start = -1; 180 start = -1;
181 while ( (start = ret.find( 'ö', start+1)) > 0 ) { 181 while ( (start = ret.find( 'ö', start+1)) > 0 ) {
182 ret.at(start-1) = 'o'; 182 ret.at(start-1) = 'o';
183 } 183 }
184 start = -1; 184 start = -1;
185 while ( (start = ret.find( 'ü', start+1)) > 0 ) { 185 while ( (start = ret.find( 'ü', start+1)) > 0 ) {
186 ret.at(start-1) = 'o'; 186 ret.at(start-1) = 'o';
187 } 187 }
188 start = -1; 188 start = -1;
189 while ( (start = ret.find( 'ß', start+1)) > 0 ) { 189 while ( (start = ret.find( 'ß', start+1)) > 0 ) {
190 ret.at(start-1) = 's'; 190 ret.at(start-1) = 's';
191 } 191 }
192 qDebug("conv string %s ", ret.latin1()); 192 //qDebug("conv string %s ", ret.latin1());
193 193
194 return ret; 194 return ret;
195 195
196 } 196 }
197 else 197 else
198#endif 198#endif
199 return QListViewItem::key(column, ascending).lower(); 199 return QListViewItem::key(column, ascending).lower();
200} 200}
201 201
202void ContactListViewItem::paintCell(QPainter * p, 202void ContactListViewItem::paintCell(QPainter * p,
203 const QColorGroup & cg, 203 const QColorGroup & cg,
204 int column, 204 int column,
205 int width, 205 int width,
206 int align) 206 int align)
207{ 207{
208 KListViewItem::paintCell(p, cg, column, width, align); 208 KListViewItem::paintCell(p, cg, column, width, align);
209 209
210 if ( !p ) 210 if ( !p )
211 return; 211 return;
212 212
213 if (parentListView->singleLine()) { 213 if (parentListView->singleLine()) {
214 p->setPen( parentListView->alternateColor() ); 214 p->setPen( parentListView->alternateColor() );
215 p->drawLine( 0, height() - 1, width, height() - 1 ); 215 p->drawLine( 0, height() - 1, width, height() - 1 );
216 } 216 }
217} 217}
218 218
219 219
220ContactListView *ContactListViewItem::parent() 220ContactListView *ContactListViewItem::parent()
221{ 221{
222 return parentListView; 222 return parentListView;
223} 223}
224 224
225 225
226void ContactListViewItem::refresh() 226void ContactListViewItem::refresh()
227{ 227{
228 // Update our addressee, since it may have changed else were 228 // Update our addressee, since it may have changed else were
229 mAddressee = mDocument->findByUid(mAddressee.uid()); 229 mAddressee = mDocument->findByUid(mAddressee.uid());
230 if (mAddressee.isEmpty()) 230 if (mAddressee.isEmpty())
231 return; 231 return;
232 232
233 int i = 0; 233 int i = 0;
234 KABC::Field::List::ConstIterator it; 234 KABC::Field::List::ConstIterator it;
235 for( it = mFields.begin(); it != mFields.end(); ++it ) { 235 for( it = mFields.begin(); it != mFields.end(); ++it ) {
236 setText( i++, (*it)->value( mAddressee ) ); 236 setText( i++, (*it)->value( mAddressee ) );
237 } 237 }
238} 238}
239 239
240/////////////////////////////// 240///////////////////////////////
241// ContactListView 241// ContactListView
242 242
243ContactListView::ContactListView(KAddressBookTableView *view, 243ContactListView::ContactListView(KAddressBookTableView *view,
244 KABC::AddressBook* /* doc */, 244 KABC::AddressBook* /* doc */,
245 QWidget *parent, 245 QWidget *parent,
246 const char *name ) 246 const char *name )
247 : KListView( parent, name ), 247 : KListView( parent, name ),
248 pabWidget( view ), 248 pabWidget( view ),
249 oldColumn( 0 ) 249 oldColumn( 0 )
250{ 250{
251 mABackground = true; 251 mABackground = true;
252 mSingleLine = false; 252 mSingleLine = false;
253 mToolTips = true; 253 mToolTips = true;
254#ifndef KAB_EMBEDDED 254#ifndef KAB_EMBEDDED
255 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 255 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
256#else //KAB_EMBEDDED 256#else //KAB_EMBEDDED
257 mAlternateColor = QColor(240, 240, 240); 257 mAlternateColor = QColor(240, 240, 240);
258#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
259 259
260 setAlternateBackgroundEnabled(mABackground); 260 setAlternateBackgroundEnabled(mABackground);
261 setAcceptDrops( true ); 261 setAcceptDrops( true );
262 viewport()->setAcceptDrops( true ); 262 viewport()->setAcceptDrops( true );
263 setAllColumnsShowFocus( true ); 263 setAllColumnsShowFocus( true );
264 setShowSortIndicator(true); 264 setShowSortIndicator(true);
265 265
266 setSelectionModeExt( KListView::Extended ); 266 setSelectionModeExt( KListView::Extended );
267 setDropVisualizer(false); 267 setDropVisualizer(false);
268 // setFrameStyle(QFrame::NoFrame); 268 // setFrameStyle(QFrame::NoFrame);
269 //setLineWidth ( 0 ); 269 //setLineWidth ( 0 );
270 //setMidLineWidth ( 0 ); 270 //setMidLineWidth ( 0 );
271 //setMargin ( 0 ); 271 //setMargin ( 0 );
272#ifndef KAB_EMBEDDED 272#ifndef KAB_EMBEDDED
273 connect(this, SIGNAL(dropped(QDropEvent*)), 273 connect(this, SIGNAL(dropped(QDropEvent*)),
274 this, SLOT(itemDropped(QDropEvent*))); 274 this, SLOT(itemDropped(QDropEvent*)));
275#endif //KAB_EMBEDDED 275#endif //KAB_EMBEDDED
276 276
277 277
278 new DynamicTip( this ); 278 new DynamicTip( this );
279} 279}
280 280
281void ContactListView::setAlternateColor(const QColor &m_AlternateColor) 281void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
282{ 282{
283 mAlternateColor = m_AlternateColor; 283 mAlternateColor = m_AlternateColor;
284} 284}
285 285
286void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) 286void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
287{ 287{
288 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); 288 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index ab95d5f..6282453 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,133 +1,134 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (c) 2004 Ulf Schenk
28 28
29$Id$ 29$Id$
30*/ 30*/
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kcombobox.h> 34#include <kcombobox.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37 37
38#include <qapplication.h>
38#include <qbuttongroup.h> 39#include <qbuttongroup.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qheader.h> 41#include <qheader.h>
41#include <qlabel.h> 42#include <qlabel.h>
42#include <qlayout.h> 43#include <qlayout.h>
43#include <qlistview.h> 44#include <qlistview.h>
44#include <qpushbutton.h> 45#include <qpushbutton.h>
45#include <qradiobutton.h> 46#include <qradiobutton.h>
46#include <qstringlist.h> 47#include <qstringlist.h>
47#include <qwhatsthis.h> 48#include <qwhatsthis.h>
48 49
49#include "kabcore.h" 50#include "kabcore.h"
50#include "kabprefs.h" 51#include "kabprefs.h"
51 52
52#include "xxportselectdialog.h" 53#include "xxportselectdialog.h"
53 54
54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 55XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
55 QWidget* parent, const char* name ) 56 QWidget* parent, const char* name )
56 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, 57 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel,
57 Ok, parent, name, true, true ), mCore( core ), 58 Ok, parent, name, true, true ), mCore( core ),
58 mUseSorting( sort ) 59 mUseSorting( sort )
59{ 60{
60 initGUI(); 61 initGUI();
61 62
62 connect( mFiltersCombo, SIGNAL( activated( int ) ), 63 connect( mFiltersCombo, SIGNAL( activated( int ) ),
63 SLOT( filterChanged( int ) ) ); 64 SLOT( filterChanged( int ) ) );
64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), 65 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
65 SLOT( categoryClicked( QListViewItem* ) ) ); 66 SLOT( categoryClicked( QListViewItem* ) ) );
66 67
67 // setup filters 68 // setup filters
68#ifndef KAB_EMBEDDED 69#ifndef KAB_EMBEDDED
69 mFilters = Filter::restore( kapp->config(), "Filter" ); 70 mFilters = Filter::restore( kapp->config(), "Filter" );
70 Filter::List::iterator filterIt; 71 Filter::List::iterator filterIt;
71#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
72 mFilters = Filter::restore( KGlobal::config(), "Filter" ); 73 mFilters = Filter::restore( KGlobal::config(), "Filter" );
73 Filter::List::Iterator filterIt; 74 Filter::List::Iterator filterIt;
74#endif //KAB_EMBEDDED 75#endif //KAB_EMBEDDED
75 QStringList filters; 76 QStringList filters;
76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 77 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
77 filters.append( (*filterIt).name() ); 78 filters.append( (*filterIt).name() );
78 79
79 mFiltersCombo->insertStringList( filters ); 80 mFiltersCombo->insertStringList( filters );
80 mUseFilters->setEnabled( filters.count() > 0 ); 81 mUseFilters->setEnabled( filters.count() > 0 );
81 82
82 // setup categories 83 // setup categories
83 QStringList categories = KABPrefs::instance()->mCustomCategories; 84 QStringList categories = KABPrefs::instance()->mCustomCategories;
84 QStringList::Iterator it; 85 QStringList::Iterator it;
85 for ( it = categories.begin(); it != categories.end(); ++it ) 86 for ( it = categories.begin(); it != categories.end(); ++it )
86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); 87 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
87 mUseCategories->setEnabled( categories.count() > 0 ); 88 mUseCategories->setEnabled( categories.count() > 0 );
88 89
89 int count = mCore->selectedUIDs().count(); 90 int count = mCore->selectedUIDs().count();
90 mUseSelection->setEnabled( count != 0 ); 91 mUseSelection->setEnabled( count != 0 );
91 mUseSelection->setChecked( count > 1 ); 92 mUseSelection->setChecked( count > 1 );
92 93
93 mSortTypeCombo->insertItem( i18n( "Ascending" ) ); 94 mSortTypeCombo->insertItem( i18n( "Ascending" ) );
94 mSortTypeCombo->insertItem( i18n( "Descending" ) ); 95 mSortTypeCombo->insertItem( i18n( "Descending" ) );
95 96
96 mFields = mCore->addressBook()->fields( KABC::Field::All ); 97 mFields = mCore->addressBook()->fields( KABC::Field::All );
97 KABC::Field::List::Iterator fieldIt; 98 KABC::Field::List::Iterator fieldIt;
98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) 99 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
99 mFieldCombo->insertItem( (*fieldIt)->label() ); 100 mFieldCombo->insertItem( (*fieldIt)->label() );
100} 101}
101 102
102QStringList XXPortSelectDialog::uids() 103QStringList XXPortSelectDialog::uids()
103{ 104{
104 QStringList uidlist; 105 QStringList uidlist;
105 KABC::AddresseeList list = contacts(); 106 KABC::AddresseeList list = contacts();
106 KABC::Addressee::List::Iterator it; 107 KABC::Addressee::List::Iterator it;
107 for ( it = list.begin(); it != list.end(); ++it ) 108 for ( it = list.begin(); it != list.end(); ++it )
108 uidlist.append((*it).uid()); 109 uidlist.append((*it).uid());
109 return uidlist; 110 return uidlist;
110} 111}
111KABC::AddresseeList XXPortSelectDialog::contacts() 112KABC::AddresseeList XXPortSelectDialog::contacts()
112{ 113{
113 QStringList selection = mCore->selectedUIDs(); 114 QStringList selection = mCore->selectedUIDs();
114 115
115 KABC::AddresseeList list; 116 KABC::AddresseeList list;
116 if ( mUseSelection->isChecked() ) { 117 if ( mUseSelection->isChecked() ) {
117 QStringList::Iterator it; 118 QStringList::Iterator it;
118 for ( it = selection.begin(); it != selection.end(); ++it ) { 119 for ( it = selection.begin(); it != selection.end(); ++it ) {
119 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 120 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
120 if ( !addr.isEmpty() ) 121 if ( !addr.isEmpty() )
121 list.append( addr ); 122 list.append( addr );
122 } 123 }
123 } else if ( mUseFilters->isChecked() ) { 124 } else if ( mUseFilters->isChecked() ) {
124 // find contacts that can pass selected filter 125 // find contacts that can pass selected filter
125 Filter::List::Iterator filterIt; 126 Filter::List::Iterator filterIt;
126 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 127 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
127 if ( (*filterIt).name() == mFiltersCombo->currentText() ) 128 if ( (*filterIt).name() == mFiltersCombo->currentText() )
128 break; 129 break;
129 130
130 KABC::AddressBook::Iterator it; 131 KABC::AddressBook::Iterator it;
131 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 132 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
132 if ( (*filterIt).filterAddressee( *it ) ) 133 if ( (*filterIt).filterAddressee( *it ) )
133 list.append( *it ); 134 list.append( *it );
@@ -152,137 +153,142 @@ KABC::AddresseeList XXPortSelectDialog::contacts()
152 } 153 }
153 154
154 if ( mUseSorting ) { 155 if ( mUseSorting ) {
155 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); 156 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
156 uint pos = mFieldCombo->currentItem(); 157 uint pos = mFieldCombo->currentItem();
157 if ( pos < mFields.count() ) 158 if ( pos < mFields.count() )
158 list.sortByField( mFields[ pos ] ); 159 list.sortByField( mFields[ pos ] );
159 } 160 }
160 161
161 return list; 162 return list;
162} 163}
163 164
164QStringList XXPortSelectDialog::categories() const 165QStringList XXPortSelectDialog::categories() const
165{ 166{
166 QStringList list; 167 QStringList list;
167 168
168 QListViewItemIterator it( mCategoriesView ); 169 QListViewItemIterator it( mCategoriesView );
169 for ( ; it.current(); ++it ) { 170 for ( ; it.current(); ++it ) {
170 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); 171 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
171 if ( qcli->isOn() ) 172 if ( qcli->isOn() )
172 list.append( it.current()->text( 0 ) ); 173 list.append( it.current()->text( 0 ) );
173 } 174 }
174 175
175 return list; 176 return list;
176} 177}
177 178
178void XXPortSelectDialog::filterChanged( int ) 179void XXPortSelectDialog::filterChanged( int )
179{ 180{
180 mUseFilters->setChecked( true ); 181 mUseFilters->setChecked( true );
181} 182}
182 183
183void XXPortSelectDialog::categoryClicked( QListViewItem *i ) 184void XXPortSelectDialog::categoryClicked( QListViewItem *i )
184{ 185{
185 QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); 186 QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
186 if ( qcli->isOn() ) 187 if ( qcli->isOn() )
187 mUseCategories->setChecked( true ); 188 mUseCategories->setChecked( true );
188} 189}
189 190
190void XXPortSelectDialog::slotHelp() 191void XXPortSelectDialog::slotHelp()
191{ 192{
192#ifndef KAB_EMBEDDED 193#ifndef KAB_EMBEDDED
193 kapp->invokeHelp( "import-and-export" ); 194 kapp->invokeHelp( "import-and-export" );
194#else //KAB_EMBEDDED 195#else //KAB_EMBEDDED
195 qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); 196 qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
196#endif //KAB_EMBEDDED 197#endif //KAB_EMBEDDED
197 198
198} 199}
199 200
200void XXPortSelectDialog::initGUI() 201void XXPortSelectDialog::initGUI()
201{ 202{
202 QFrame *page = plainPage(); 203 QFrame *page = plainPage();
203 204
204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), 205 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
205 KDialog::spacingHint() ); 206 KDialog::spacingHint() );
206 207
207 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); 208 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
208 topLayout->addWidget( label ); 209 topLayout->addWidget( label );
209 210
210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); 211 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
211 mButtonGroup->setColumnLayout( 0, Qt::Vertical ); 212 mButtonGroup->setColumnLayout( 0, Qt::Vertical );
212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); 213 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
213 mButtonGroup->layout()->setMargin( KDialog::marginHint() ); 214 mButtonGroup->layout()->setMargin( KDialog::marginHint() );
214 215
215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); 216 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
216 groupLayout->setAlignment( Qt::AlignTop ); 217 groupLayout->setAlignment( Qt::AlignTop );
217 218
218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); 219 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
219 mUseWholeBook->setChecked( true ); 220 mUseWholeBook->setChecked( true );
220 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); 221 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
221 groupLayout->addWidget( mUseWholeBook, 0, 0 ); 222 groupLayout->addWidget( mUseWholeBook, 0, 0 );
222 223
223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); 224 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
224 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" 225 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
225 "This option is disabled if no contacts are selected." ) ); 226 "This option is disabled if no contacts are selected." ) );
226 groupLayout->addWidget( mUseSelection, 1, 0 ); 227 groupLayout->addWidget( mUseSelection, 1, 0 );
227 228
228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); 229 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
229 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" 230 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
230 "This option is disabled if you haven't defined any filters" ) ); 231 "This option is disabled if you haven't defined any filters" ) );
231 groupLayout->addWidget( mUseFilters, 2, 0 ); 232 groupLayout->addWidget( mUseFilters, 2, 0 );
232 233
233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); 234 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
234 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" 235 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
235 "This option is disabled if you have no categories." ) ); 236 "This option is disabled if you have no categories." ) );
236 groupLayout->addWidget( mUseCategories, 3, 0 ); 237 groupLayout->addWidget( mUseCategories, 3, 0 );
237 238
238 mFiltersCombo = new QComboBox( false, mButtonGroup ); 239 mFiltersCombo = new QComboBox( false, mButtonGroup );
239 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); 240 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
240 groupLayout->addWidget( mFiltersCombo, 2, 1 ); 241 groupLayout->addWidget( mFiltersCombo, 2, 1 );
241 242
242 mCategoriesView = new QListView( mButtonGroup ); 243 mCategoriesView = new QListView( mButtonGroup );
243 mCategoriesView->addColumn( "" ); 244 mCategoriesView->addColumn( "" );
244 mCategoriesView->header()->hide(); 245 mCategoriesView->header()->hide();
245 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); 246 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
246 groupLayout->addWidget( mCategoriesView, 3, 1 ); 247 groupLayout->addWidget( mCategoriesView, 3, 1 );
247 248
249 // if (QApplication::desktop()->height() == 480 )
250 // mCategoriesView->setMaximumHeight( 240 );
248 topLayout->addWidget( mButtonGroup ); 251 topLayout->addWidget( mButtonGroup );
249 252
250 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); 253 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
251 sortingGroup->setColumnLayout( 0, Qt::Vertical ); 254 sortingGroup->setColumnLayout( 0, Qt::Vertical );
252 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, 255 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
253 KDialog::spacingHint() ); 256 KDialog::spacingHint() );
254 sortLayout->setAlignment( Qt::AlignTop ); 257 sortLayout->setAlignment( Qt::AlignTop );
255 258
256 label = new QLabel( i18n( "Criterion:" ), sortingGroup ); 259 label = new QLabel( i18n( "Criterion:" ), sortingGroup );
257 sortLayout->addWidget( label, 0, 0 ); 260 sortLayout->addWidget( label, 0, 0 );
258 261
259#ifndef KAB_EMBEDDED 262#ifndef KAB_EMBEDDED
260 mFieldCombo = new KComboBox( false, sortingGroup ); 263 mFieldCombo = new KComboBox( false, sortingGroup );
261#else //KAB_EMBEDDED 264#else //KAB_EMBEDDED
262 //US Combobox is not editable anyway 265 //US Combobox is not editable anyway
263 mFieldCombo = new KComboBox( sortingGroup ); 266 mFieldCombo = new KComboBox( sortingGroup );
264#endif //KAB_EMBEDDED 267#endif //KAB_EMBEDDED
265 sortLayout->addWidget( mFieldCombo, 0, 1 ); 268 sortLayout->addWidget( mFieldCombo, 0, 1 );
266 269
267 label = new QLabel( i18n( "Order:" ), sortingGroup ); 270 label = new QLabel( i18n( "Order:" ), sortingGroup );
268 sortLayout->addWidget( label, 1, 0 ); 271 sortLayout->addWidget( label, 1, 0 );
269 272
270#ifndef KAB_EMBEDDED 273#ifndef KAB_EMBEDDED
271 mSortTypeCombo = new KComboBox( false, sortingGroup ); 274 mSortTypeCombo = new KComboBox( false, sortingGroup );
272#else //KAB_EMBEDDED 275#else //KAB_EMBEDDED
273 //US Combobox is not editable anyway 276 //US Combobox is not editable anyway
274 mSortTypeCombo = new KComboBox( sortingGroup ); 277 mSortTypeCombo = new KComboBox( sortingGroup );
275#endif //KAB_EMBEDDED 278#endif //KAB_EMBEDDED
276 sortLayout->addWidget( mSortTypeCombo, 1, 1 ); 279 sortLayout->addWidget( mSortTypeCombo, 1, 1 );
277 280
278 topLayout->addWidget( sortingGroup ); 281 topLayout->addWidget( sortingGroup );
279 282
280 if ( !mUseSorting ) 283 if ( !mUseSorting )
281 sortingGroup->hide(); 284 sortingGroup->hide();
285#ifndef DESKTOP_VERSION
286 hideButtons();
287#endif
282} 288}
283 289
284#ifndef KAB_EMBEDDED 290#ifndef KAB_EMBEDDED
285#include "xxportselectdialog.moc" 291#include "xxportselectdialog.moc"
286#endif //KAB_EMBEDDED 292#endif //KAB_EMBEDDED
287 293
288 294