summaryrefslogtreecommitdiffabout
path: root/kaddressbook/incsearchwidget.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/incsearchwidget.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-p1.zip
kdepimpi-p1.tar.gz
kdepimpi-p1.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/incsearchwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 5f8b83d..a54d1cd 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -4,71 +4,75 @@
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 <qapplication.h> 27#include <qapplication.h>
28#include <QDesktopWidget>
28#include <qcombobox.h> 29#include <qcombobox.h>
30//Added by qt3to4:
31#include <Q3HBoxLayout>
29 32
30#include <kdialog.h> 33#include <kdialog.h>
31#include <klineedit.h> 34#include <klineedit.h>
32#include <klocale.h> 35#include <klocale.h>
33#include <kglobal.h> 36#include <kglobal.h>
34#include <kglobal.h> 37#include <kglobal.h>
35#include "kabprefs.h" 38#include "kabprefs.h"
36 39
37#include "incsearchwidget.h" 40#include "incsearchwidget.h"
38 41
39IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 42IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
40 : QWidget( parent, name )
41{ 43{
44 setObjectName(name);
45 setParent(parent);
42#ifndef KAB_EMBEDDED 46#ifndef KAB_EMBEDDED
43//US setCaption( i18n( "Incremental Search" ) ); 47//US setCaption( i18n( "Incremental Search" ) );
44#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
45 49
46 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); 50 Q3HBoxLayout *layout = new Q3HBoxLayout( this, 2, KDialog::spacingHint() );
47 51
48#ifdef DESKTOP_VERSION 52#ifdef DESKTOP_VERSION
49 QLabel *label = new QLabel( i18n( "Search:" ), this ); 53 QLabel *label = new QLabel( i18n( "Search:" ), this );
50 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); 54 label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
51 layout->addWidget( label ); 55 layout->addWidget( label );
52#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
53 57
54 mSearchText = new KLineEdit( this ); 58 mSearchText = new KLineEdit( this );
55 layout->addWidget( mSearchText ); 59 layout->addWidget( mSearchText );
56// #ifdef KAB_EMBEDDED 60// #ifdef KAB_EMBEDDED
57// if (KGlobal::getOrientation() == KGlobal::Portrait) 61// if (KGlobal::getOrientation() == KGlobal::Portrait)
58// mSearchText->setMaximumWidth(30); 62// mSearchText->setMaximumWidth(30);
59// #endif //KAB_EMBEDDED 63// #endif //KAB_EMBEDDED
60 //mSearchText->setMaximumWidth(60); 64 //mSearchText->setMaximumWidth(60);
61 65
62 66
63 mFieldCombo = new QComboBox( false, this ); 67 mFieldCombo = new QComboBox( false, this );
64 layout->addWidget( mFieldCombo ); 68 layout->addWidget( mFieldCombo );
65 mFieldCombo->setMaximumHeight( 34 ); 69 mFieldCombo->setMaximumHeight( 34 );
66 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 70 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
67 71
68// #ifndef KAB_EMBEDDED 72// #ifndef KAB_EMBEDDED
69// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 73// resize( QSize(420, 50).expandedTo( sizeHint() ) );
70// #else //KAB_EMBEDDED 74// #else //KAB_EMBEDDED
71// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 75// resize( QSize(30, 10).expandedTo( sizeHint() ) );
72// #endif //KAB_EMBEDDED 76// #endif //KAB_EMBEDDED
73 77
74 78
@@ -155,27 +159,27 @@ void IncSearchWidget::setFields( const KABC::Field::List &list )
155KABC::Field::List IncSearchWidget::fields() const 159KABC::Field::List IncSearchWidget::fields() const
156{ 160{
157 return mFieldList; 161 return mFieldList;
158} 162}
159 163
160KABC::Field *IncSearchWidget::currentField()const 164KABC::Field *IncSearchWidget::currentField()const
161{ 165{
162 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 166 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
163 return 0; // for error or 'use all fields' 167 return 0; // for error or 'use all fields'
164 else 168 else
165 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 169 return mFieldList[ mFieldCombo->currentItem() - 1 ];
166} 170}
167 171
168void IncSearchWidget::setCurrentItem( int pos ) 172void IncSearchWidget::setCurrentItem( int pos )
169{ 173{
170 mFieldCombo->setCurrentItem( pos ); 174 mFieldCombo->setCurrentItem( pos );
171 announceFieldChanged(); 175 announceFieldChanged();
172} 176}
173 177
174int IncSearchWidget::currentItem() const 178int IncSearchWidget::currentItem() const
175{ 179{
176 180
177 return mFieldCombo->currentItem(); 181 return mFieldCombo->currentItem();
178} 182}
179#ifndef KAB_EMBEDDED 183#ifndef KAB_EMBEDDED_
180#include "incsearchwidget.moc" 184#include "moc_incsearchwidget.cpp"
181#endif //KAB_EMBEDDED 185#endif //KAB_EMBEDDED