summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewconfigurefieldspage.cpp
Unidiff
Diffstat (limited to 'kaddressbook/viewconfigurefieldspage.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/viewconfigurefieldspage.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/kaddressbook/viewconfigurefieldspage.cpp b/kaddressbook/viewconfigurefieldspage.cpp
index 5daae1a..7366a0b 100644
--- a/kaddressbook/viewconfigurefieldspage.cpp
+++ b/kaddressbook/viewconfigurefieldspage.cpp
@@ -1,351 +1,355 @@
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#ifndef KAB_EMBEDDED 24#ifndef KAB_EMBEDDED
25#include <kcombobox.h> 25#include <kcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <kdebug.h> 27#include <kdebug.h>
28 28
29#else //KAB_EMBEDDED 29#else //KAB_EMBEDDED
30#include <qcombobox.h> 30#include <qcombobox.h>
31#endif //KAB_EMBEDDED 31#endif //KAB_EMBEDDED
32 32
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kdialog.h> 34#include <kdialog.h>
35#include <klocale.h> 35#include <klocale.h>
36 36
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39#include <QDesktopWidget>
39#include <qlabel.h> 40#include <qlabel.h>
40#include <qlistbox.h> 41#include <q3listbox.h>
41#include <qlayout.h> 42#include <qlayout.h>
43//Added by qt3to4:
44#include <Q3GridLayout>
45#include <Q3BoxLayout>
42 46
43#include "viewconfigurefieldspage.h" 47#include "viewconfigurefieldspage.h"
44 48
45class FieldItem : public QListBoxText 49class FieldItem : public Q3ListBoxText
46{ 50{
47 public: 51 public:
48 FieldItem( QListBox *parent, KABC::Field *field ) 52 FieldItem( Q3ListBox *parent, KABC::Field *field )
49 : QListBoxText( parent, field->label() ), mField( field ) {} 53 : Q3ListBoxText( parent, field->label() ), mField( field ) {}
50 54
51 FieldItem( QListBox *parent, KABC::Field *field, int index ) 55 FieldItem( Q3ListBox *parent, KABC::Field *field, int index )
52 : QListBoxText( parent, field->label(), parent->item( index ) ), 56 : Q3ListBoxText( parent, field->label(), parent->item( index ) ),
53 mField( field ) {} 57 mField( field ) {}
54 58
55 KABC::Field *field() { return mField; } 59 KABC::Field *field() { return mField; }
56 60
57 private: 61 private:
58 KABC::Field *mField; 62 KABC::Field *mField;
59}; 63};
60 64
61 65
62ViewConfigureFieldsPage::ViewConfigureFieldsPage( KABC::AddressBook *ab, 66ViewConfigureFieldsPage::ViewConfigureFieldsPage( KABC::AddressBook *ab,
63 QWidget *parent, 67 QWidget *parent,
64 const char *name ) 68 const char *name )
65 : QWidget( parent, name ), mAddressBook( ab ) 69 : QWidget( parent, name ), mAddressBook( ab )
66{ 70{
67 initGUI(); 71 initGUI();
68} 72}
69 73
70void ViewConfigureFieldsPage::restoreSettings( KConfig *config ) 74void ViewConfigureFieldsPage::restoreSettings( KConfig *config )
71{ 75{
72 KABC::Field::List fields = KABC::Field::restoreFields( config, "KABCFields" ); 76 KABC::Field::List fields = KABC::Field::restoreFields( config, "KABCFields" );
73 77
74 if ( fields.isEmpty() ) 78 if ( fields.isEmpty() )
75 fields = KABC::Field::defaultFields(); 79 fields = KABC::Field::defaultFields();
76 80
77 KABC::Field::List::ConstIterator it; 81 KABC::Field::List::ConstIterator it;
78 for( it = fields.begin(); it != fields.end(); ++it ) 82 for( it = fields.begin(); it != fields.end(); ++it )
79 new FieldItem( mSelectedBox, *it ); 83 new FieldItem( mSelectedBox, *it );
80 84
81 slotShowFields( mCategoryCombo->currentItem() ); 85 slotShowFields( mCategoryCombo->currentItem() );
82} 86}
83 87
84void ViewConfigureFieldsPage::saveSettings( KConfig *config ) 88void ViewConfigureFieldsPage::saveSettings( KConfig *config )
85{ 89{
86 KABC::Field::List fields; 90 KABC::Field::List fields;
87 91
88 for( uint i = 0; i < mSelectedBox->count(); ++i ) { 92 for( uint i = 0; i < mSelectedBox->count(); ++i ) {
89 FieldItem *fieldItem = static_cast<FieldItem *>( mSelectedBox->item( i ) ); 93 FieldItem *fieldItem = static_cast<FieldItem *>( mSelectedBox->item( i ) );
90 fields.append( fieldItem->field() ); 94 fields.append( fieldItem->field() );
91 } 95 }
92 96
93 KABC::Field::saveFields( config, "KABCFields", fields ); 97 KABC::Field::saveFields( config, "KABCFields", fields );
94} 98}
95 99
96void ViewConfigureFieldsPage::slotShowFields( int index ) 100void ViewConfigureFieldsPage::slotShowFields( int index )
97{ 101{
98 int currentPos = mUnSelectedBox->currentItem(); 102 int currentPos = mUnSelectedBox->currentItem();
99 mUnSelectedBox->clear(); 103 mUnSelectedBox->clear();
100 104
101 int category; 105 int category;
102 if ( index == 0 ) category = KABC::Field::All; 106 if ( index == 0 ) category = KABC::Field::All;
103 else category = 1 << ( index - 1 ); 107 else category = 1 << ( index - 1 );
104 108
105 KABC::Field::List allFields = mAddressBook->fields( category ); 109 KABC::Field::List allFields = mAddressBook->fields( category );
106 110
107 KABC::Field::List::ConstIterator it; 111 KABC::Field::List::ConstIterator it;
108 for ( it = allFields.begin(); it != allFields.end(); ++it ) { 112 for ( it = allFields.begin(); it != allFields.end(); ++it ) {
109 QListBoxItem *item = mSelectedBox->firstItem(); 113 Q3ListBoxItem *item = mSelectedBox->firstItem();
110 while( item ) { 114 while( item ) {
111 FieldItem *fieldItem = static_cast<FieldItem *>( item ); 115 FieldItem *fieldItem = static_cast<FieldItem *>( item );
112 if ( (*it)->equals( fieldItem->field() ) ) 116 if ( (*it)->equals( fieldItem->field() ) )
113 break; 117 break;
114 item = item->next(); 118 item = item->next();
115 } 119 }
116 120
117 if ( !item ) 121 if ( !item )
118 new FieldItem( mUnSelectedBox, *it ); 122 new FieldItem( mUnSelectedBox, *it );
119 } 123 }
120 124
121 mUnSelectedBox->sort(); 125 mUnSelectedBox->sort();
122 mUnSelectedBox->setCurrentItem( currentPos ); 126 mUnSelectedBox->setCurrentItem( currentPos );
123} 127}
124 128
125void ViewConfigureFieldsPage::slotSelect() 129void ViewConfigureFieldsPage::slotSelect()
126{ 130{
127 // insert selected items in the unselected list to the selected list, 131 // insert selected items in the unselected list to the selected list,
128 // directoy under the current item if selected, or at the bottonm if 132 // directoy under the current item if selected, or at the bottonm if
129 // nothing is selected in the selected list 133 // nothing is selected in the selected list
130 int where = mSelectedBox->currentItem(); 134 int where = mSelectedBox->currentItem();
131//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead. 135//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
132 if ( !(where > -1 && mSelectedBox->item( where )->selected()) ) 136 if ( !(where > -1 && mSelectedBox->item( where )->selected()) )
133 where = mSelectedBox->count() - 1; 137 where = mSelectedBox->count() - 1;
134 138
135 for ( uint i = 0; i < mUnSelectedBox->count(); ++i ) 139 for ( uint i = 0; i < mUnSelectedBox->count(); ++i )
136 if ( mUnSelectedBox->isSelected( mUnSelectedBox->item( i ) ) ) { 140 if ( mUnSelectedBox->isSelected( mUnSelectedBox->item( i ) ) ) {
137 FieldItem *fieldItem = static_cast<FieldItem *>( mUnSelectedBox->item( i ) ); 141 FieldItem *fieldItem = static_cast<FieldItem *>( mUnSelectedBox->item( i ) );
138 new FieldItem( mSelectedBox, fieldItem->field(), where ); 142 new FieldItem( mSelectedBox, fieldItem->field(), where );
139 where++; 143 where++;
140 } 144 }
141 145
142 slotShowFields( mCategoryCombo->currentItem() ); 146 slotShowFields( mCategoryCombo->currentItem() );
143} 147}
144 148
145void ViewConfigureFieldsPage::slotUnSelect() 149void ViewConfigureFieldsPage::slotUnSelect()
146{ 150{
147 for ( uint i = 0; i < mSelectedBox->count(); ++i ) 151 for ( uint i = 0; i < mSelectedBox->count(); ++i )
148 if ( mSelectedBox->isSelected( mSelectedBox->item( i ) ) ) { 152 if ( mSelectedBox->isSelected( mSelectedBox->item( i ) ) ) {
149 mSelectedBox->removeItem( i ); 153 mSelectedBox->removeItem( i );
150 --i; 154 --i;
151 } 155 }
152 156
153 slotShowFields( mCategoryCombo->currentItem() ); 157 slotShowFields( mCategoryCombo->currentItem() );
154} 158}
155 159
156void ViewConfigureFieldsPage::slotButtonsEnabled() 160void ViewConfigureFieldsPage::slotButtonsEnabled()
157{ 161{
158 bool state = false; 162 bool state = false;
159 // add button: enabled if any items are selected in the unselected list 163 // add button: enabled if any items are selected in the unselected list
160 for( uint i = 0; i < mUnSelectedBox->count(); ++i ) 164 for( uint i = 0; i < mUnSelectedBox->count(); ++i )
161//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead. 165//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
162 if ( mUnSelectedBox->item( i )->selected() ) { 166 if ( mUnSelectedBox->item( i )->selected() ) {
163 state = true; 167 state = true;
164 break; 168 break;
165 } 169 }
166 mAddButton->setEnabled( state ); 170 mAddButton->setEnabled( state );
167 171
168 int j = mSelectedBox->currentItem(); 172 int j = mSelectedBox->currentItem();
169 state = ( j > -1 && mSelectedBox->isSelected( j ) ); 173 state = ( j > -1 && mSelectedBox->isSelected( j ) );
170 174
171 // up button: enabled if there is a current item > 0 and that is selected 175 // up button: enabled if there is a current item > 0 and that is selected
172 mUpButton->setEnabled( ( j > 0 && state ) ); 176 mUpButton->setEnabled( ( j > 0 && state ) );
173 177
174 // down button: enabled if there is a current item < count - 2 and that is selected 178 // down button: enabled if there is a current item < count - 2 and that is selected
175 mDownButton->setEnabled( ( j > -1 && j < (int)mSelectedBox->count() - 1 && state ) ); 179 mDownButton->setEnabled( ( j > -1 && j < (int)mSelectedBox->count() - 1 && state ) );
176 180
177 // remove button: enabled if any items are selected in the selected list 181 // remove button: enabled if any items are selected in the selected list
178 state = false; 182 state = false;
179 for ( uint i = 0; i < mSelectedBox->count(); ++i ) 183 for ( uint i = 0; i < mSelectedBox->count(); ++i )
180//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead. 184//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
181 if ( mSelectedBox->item( i )->selected() ) { 185 if ( mSelectedBox->item( i )->selected() ) {
182 state = true; 186 state = true;
183 break; 187 break;
184 } 188 }
185 mRemoveButton->setEnabled( state ); 189 mRemoveButton->setEnabled( state );
186} 190}
187 191
188void ViewConfigureFieldsPage::slotMoveUp() 192void ViewConfigureFieldsPage::slotMoveUp()
189{ 193{
190 int i = mSelectedBox->currentItem(); 194 int i = mSelectedBox->currentItem();
191 if ( i > 0 ) { 195 if ( i > 0 ) {
192 QListBoxItem *item = mSelectedBox->item( i ); 196 Q3ListBoxItem *item = mSelectedBox->item( i );
193 mSelectedBox->takeItem( item ); 197 mSelectedBox->takeItem( item );
194 mSelectedBox->insertItem( item, i - 1 ); 198 mSelectedBox->insertItem( item, i - 1 );
195 mSelectedBox->setCurrentItem( item ); 199 mSelectedBox->setCurrentItem( item );
196 mSelectedBox->setSelected( i - 1, true ); 200 mSelectedBox->setSelected( i - 1, true );
197 } 201 }
198} 202}
199 203
200void ViewConfigureFieldsPage::slotMoveDown() 204void ViewConfigureFieldsPage::slotMoveDown()
201{ 205{
202 int i = mSelectedBox->currentItem(); 206 int i = mSelectedBox->currentItem();
203 if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) { 207 if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) {
204 QListBoxItem *item = mSelectedBox->item( i ); 208 Q3ListBoxItem *item = mSelectedBox->item( i );
205 mSelectedBox->takeItem( item ); 209 mSelectedBox->takeItem( item );
206 mSelectedBox->insertItem( item, i + 1 ); 210 mSelectedBox->insertItem( item, i + 1 );
207 mSelectedBox->setCurrentItem( item ); 211 mSelectedBox->setCurrentItem( item );
208 mSelectedBox->setSelected( i + 1, true ); 212 mSelectedBox->setSelected( i + 1, true );
209 } 213 }
210} 214}
211 215
212void ViewConfigureFieldsPage::initGUI() 216void ViewConfigureFieldsPage::initGUI()
213{ 217{
214 //US change the orientation dependent on the following flag 218 //US change the orientation dependent on the following flag
215 // right the flag is set only staticly. 219 // right the flag is set only staticly.
216 // 0 = 640x480 ; 1 = 240x320 220 // 0 = 640x480 ; 1 = 240x320
217 bool orientation = 1; 221 bool orientation = 1;
218 222
219 223
220 setCaption( i18n("Select Fields to Display") ); 224 setCaption( i18n("Select Fields to Display") );
221 225
222 QGridLayout *gl = 0; 226 Q3GridLayout *gl = 0;
223 if (orientation == 0) 227 if (orientation == 0)
224 gl = new QGridLayout( this , 6, 4, 0, KDialog::spacingHint() ); 228 gl = new Q3GridLayout( this , 6, 4, 0, KDialog::spacingHint() );
225 else 229 else
226 gl = new QGridLayout( this , 4, 6, 0, KDialog::spacingHint() ); 230 gl = new Q3GridLayout( this , 4, 6, 0, KDialog::spacingHint() );
227 231
228 #ifndef KAB_EMBEDDED 232 #ifndef KAB_EMBEDDED
229 mCategoryCombo = new KComboBox( false, this ); 233 mCategoryCombo = new KComboBox( false, this );
230 #else //KAB_EMBEDDED 234 #else //KAB_EMBEDDED
231 mCategoryCombo = new QComboBox( false, this ); 235 mCategoryCombo = new QComboBox( false, this );
232 #endif //KAB_EMBEDDED 236 #endif //KAB_EMBEDDED
233 if ( QApplication::desktop()->width() < 320 ) 237 if ( QApplication::desktop()->width() < 320 )
234 mCategoryCombo->setMaximumWidth( 70 ); 238 mCategoryCombo->setMaximumWidth( 70 );
235 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::All ) ); 239 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::All ) );
236 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Frequent ) ); 240 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Frequent ) );
237 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Address ) ); 241 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Address ) );
238 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Email ) ); 242 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Email ) );
239 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Personal ) ); 243 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Personal ) );
240 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Organization ) ); 244 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Organization ) );
241 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::CustomCategory ) ); 245 mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::CustomCategory ) );
242 connect( mCategoryCombo, SIGNAL( activated(int) ), SLOT( slotShowFields(int) ) ); 246 connect( mCategoryCombo, SIGNAL( activated(int) ), SLOT( slotShowFields(int) ) );
243 gl->addWidget( mCategoryCombo, 0, 0 ); 247 gl->addWidget( mCategoryCombo, 0, 0 );
244 248
245 QLabel *label = new QLabel( i18n( "&Selected\nfields:" ), this ); 249 QLabel *label = new QLabel( i18n( "&Selected\nfields:" ), this );
246 if (orientation == 0) 250 if (orientation == 0)
247 gl->addWidget( label, 0, 2 ); 251 gl->addWidget( label, 0, 2 );
248 else 252 else
249 gl->addWidget( label, 2, 0 ); 253 gl->addWidget( label, 2, 0 );
250 254
251 255
252 mUnSelectedBox = new QListBox( this ); 256 mUnSelectedBox = new Q3ListBox( this );
253 mUnSelectedBox->setSelectionMode( QListBox::Extended ); 257 mUnSelectedBox->setSelectionMode( Q3ListBox::Extended );
254 mUnSelectedBox->setMinimumHeight( 80 ); 258 mUnSelectedBox->setMinimumHeight( 80 );
255 if (orientation == 0) 259 if (orientation == 0)
256 gl->addWidget( mUnSelectedBox, 1, 0 ); 260 gl->addWidget( mUnSelectedBox, 1, 0 );
257 else 261 else
258 gl->addWidget( mUnSelectedBox, 0, 1 ); 262 gl->addWidget( mUnSelectedBox, 0, 1 );
259 263
260 mSelectedBox = new QListBox( this ); 264 mSelectedBox = new Q3ListBox( this );
261 //if ( QApplication::desktop()->width() < 320 ) { 265 //if ( QApplication::desktop()->width() < 320 ) {
262 // mUnSelectedBox->setMaximumWidth( 134 ); 266 // mUnSelectedBox->setMaximumWidth( 134 );
263 // mSelectedBox->setMaximumWidth( 134 ); 267 // mSelectedBox->setMaximumWidth( 134 );
264 //} 268 //}
265 mSelectedBox->setSelectionMode( QListBox::Extended ); 269 mSelectedBox->setSelectionMode( Q3ListBox::Extended );
266 mSelectedBox->setMinimumHeight( 80 ); 270 mSelectedBox->setMinimumHeight( 80 );
267 label->setBuddy( mSelectedBox ); 271 label->setBuddy( mSelectedBox );
268 if (orientation == 0) 272 if (orientation == 0)
269 gl->addWidget( mSelectedBox, 1, 2 ); 273 gl->addWidget( mSelectedBox, 1, 2 );
270 else 274 else
271 gl->addWidget( mSelectedBox, 2, 1 ); 275 gl->addWidget( mSelectedBox, 2, 1 );
272 276
273 QBoxLayout *vb1 = 0; 277 Q3BoxLayout *vb1 = 0;
274 if (orientation == 0) 278 if (orientation == 0)
275 vb1 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); 279 vb1 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
276 else 280 else
277 vb1 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); 281 vb1 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
278 282
279 vb1->addStretch(); 283 vb1->addStretch();
280 284
281 mAddButton = new QToolButton( this ); 285 mAddButton = new QToolButton( this );
282 if (orientation == 0) 286 if (orientation == 0)
283 mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) ); 287 mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) );
284 else 288 else
285 mAddButton->setIconSet( SmallIconSet( "1downarrow" ) ); 289 mAddButton->setIconSet( SmallIconSet( "1downarrow" ) );
286 connect( mAddButton, SIGNAL( clicked() ), SLOT( slotSelect() ) ); 290 connect( mAddButton, SIGNAL( clicked() ), SLOT( slotSelect() ) );
287 vb1->addWidget( mAddButton ); 291 vb1->addWidget( mAddButton );
288 292
289 mRemoveButton = new QToolButton( this ); 293 mRemoveButton = new QToolButton( this );
290 if (orientation == 0) 294 if (orientation == 0)
291 mRemoveButton->setIconSet( SmallIconSet( "1leftarrow" ) ); 295 mRemoveButton->setIconSet( SmallIconSet( "1leftarrow" ) );
292 else 296 else
293 mRemoveButton->setIconSet( SmallIconSet( "1uparrow" ) ); 297 mRemoveButton->setIconSet( SmallIconSet( "1uparrow" ) );
294 298
295 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotUnSelect() ) ); 299 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotUnSelect() ) );
296 vb1->addWidget( mRemoveButton ); 300 vb1->addWidget( mRemoveButton );
297 301
298 vb1->addStretch(); 302 vb1->addStretch();
299 if (orientation == 0) 303 if (orientation == 0)
300 gl->addLayout( vb1, 1, 1 ); 304 gl->addLayout( vb1, 1, 1 );
301 else 305 else
302 gl->addLayout( vb1, 1, 1 ); 306 gl->addLayout( vb1, 1, 1 );
303 307
304 QBoxLayout *vb2 = 0; 308 Q3BoxLayout *vb2 = 0;
305 if (orientation == 0) 309 if (orientation == 0)
306 vb2 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); 310 vb2 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
307 else 311 else
308 vb2 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); 312 vb2 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
309 313
310 vb2->addStretch(); 314 vb2->addStretch();
311 315
312 mUpButton = new QToolButton( this ); 316 mUpButton = new QToolButton( this );
313 mUpButton->setIconSet( SmallIconSet( "1uparrow" ) ); 317 mUpButton->setIconSet( SmallIconSet( "1uparrow" ) );
314 connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) ); 318 connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) );
315 vb2->addWidget( mUpButton ); 319 vb2->addWidget( mUpButton );
316 320
317 mDownButton = new QToolButton( this ); 321 mDownButton = new QToolButton( this );
318 mDownButton->setIconSet( SmallIconSet( "1downarrow" ) ); 322 mDownButton->setIconSet( SmallIconSet( "1downarrow" ) );
319 connect( mDownButton, SIGNAL( clicked() ), SLOT( slotMoveDown() ) ); 323 connect( mDownButton, SIGNAL( clicked() ), SLOT( slotMoveDown() ) );
320 vb2->addWidget( mDownButton ); 324 vb2->addWidget( mDownButton );
321 325
322 vb2->addStretch(); 326 vb2->addStretch();
323 if (orientation == 0) 327 if (orientation == 0)
324 gl->addLayout( vb2, 1, 3 ); 328 gl->addLayout( vb2, 1, 3 );
325 else 329 else
326 gl->addLayout( vb2, 3, 1 ); 330 gl->addLayout( vb2, 3, 1 );
327 331
328 QSize sizeHint = mUnSelectedBox->sizeHint(); 332 QSize sizeHint = mUnSelectedBox->sizeHint();
329 333
330 // make sure we fill the list with all items, so that we can 334 // make sure we fill the list with all items, so that we can
331 // get the maxItemWidth we need to not truncate the view 335 // get the maxItemWidth we need to not truncate the view
332 slotShowFields( 0 ); 336 slotShowFields( 0 );
333 337
334 //sizeHint = sizeHint.expandedTo( mSelectedBox->sizeHint() ); 338 //sizeHint = sizeHint.expandedTo( mSelectedBox->sizeHint() );
335 //sizeHint.setWidth( mUnSelectedBox->maxItemWidth() ); 339 //sizeHint.setWidth( mUnSelectedBox->maxItemWidth() );
336 // mUnSelectedBox->setMinimumSize( sizeHint ); 340 // mUnSelectedBox->setMinimumSize( sizeHint );
337 //mSelectedBox->setMinimumSize( sizeHint ); 341 //mSelectedBox->setMinimumSize( sizeHint );
338 342
339 gl->activate(); 343 gl->activate();
340 344
341 connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); 345 connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
342 connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); 346 connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
343 connect( mSelectedBox, SIGNAL( currentChanged( QListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); 347 connect( mSelectedBox, SIGNAL( currentChanged( Q3ListBoxItem * ) ), SLOT( slotButtonsEnabled() ) );
344 348
345 slotButtonsEnabled(); 349 slotButtonsEnabled();
346} 350}
347 351
348 352
349#ifndef KAB_EMBEDDED 353#ifndef KAB_EMBEDDED_
350#include "viewconfigurefieldspage.moc" 354#include "moc_viewconfigurefieldspage.cpp"
351#endif //KAB_EMBEDDED 355#endif //KAB_EMBEDDED