summaryrefslogtreecommitdiffabout
path: root/kaddressbook/incsearchwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/incsearchwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 3533427..78eaf65 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -52,80 +52,86 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
52 52
53 mSearchText = new KLineEdit( this ); 53 mSearchText = new KLineEdit( this );
54 layout->addWidget( mSearchText ); 54 layout->addWidget( mSearchText );
55// #ifdef KAB_EMBEDDED 55// #ifdef KAB_EMBEDDED
56// if (KGlobal::getOrientation() == KGlobal::Portrait) 56// if (KGlobal::getOrientation() == KGlobal::Portrait)
57// mSearchText->setMaximumWidth(30); 57// mSearchText->setMaximumWidth(30);
58// #endif //KAB_EMBEDDED 58// #endif //KAB_EMBEDDED
59 59
60 60
61 mFieldCombo = new QComboBox( false, this ); 61 mFieldCombo = new QComboBox( false, this );
62 layout->addWidget( mFieldCombo ); 62 layout->addWidget( mFieldCombo );
63 mFieldCombo->setMaximumHeight( 34 ); 63 mFieldCombo->setMaximumHeight( 34 );
64 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 64 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
65 65
66// #ifndef KAB_EMBEDDED 66// #ifndef KAB_EMBEDDED
67// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 67// resize( QSize(420, 50).expandedTo( sizeHint() ) );
68// #else //KAB_EMBEDDED 68// #else //KAB_EMBEDDED
69// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 69// resize( QSize(30, 10).expandedTo( sizeHint() ) );
70// #endif //KAB_EMBEDDED 70// #endif //KAB_EMBEDDED
71 71
72 72
73 // for performance reasons, we do a search on the pda only after return is pressed 73 // for performance reasons, we do a search on the pda only after return is pressed
74 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 74 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
75 SLOT( announceDoSearch2() ) ); 75 SLOT( announceDoSearch2() ) );
76 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 76 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
77 SLOT( announceDoSearch2() ) ); 77 SLOT( announceDoSearch2() ) );
78 78
79 connect( mSearchText, SIGNAL( returnPressed() ), 79 connect( mSearchText, SIGNAL( returnPressed() ),
80 SLOT( announceDoSearch() ) ); 80 SLOT( announceDoSearch() ) );
81 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 81 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
82 SLOT( announceFieldChanged() ) ); 82 SLOT( announceFieldChanged() ) );
83 83
84
85
86 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
87 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
88
89
84 setFocusProxy( mSearchText ); 90 setFocusProxy( mSearchText );
85} 91}
86 92
87IncSearchWidget::~IncSearchWidget() 93IncSearchWidget::~IncSearchWidget()
88{ 94{
89 95
90} 96}
91void IncSearchWidget::announceDoSearch2() 97void IncSearchWidget::announceDoSearch2()
92{ 98{
93 if ( KABPrefs::instance()->mSearchWithReturn ) 99 if ( KABPrefs::instance()->mSearchWithReturn )
94 return; 100 return;
95 emit doSearch( mSearchText->text() ); 101 emit doSearch( mSearchText->text() );
96 //qDebug("emit dosreach "); 102 //qDebug("emit dosreach ");
97} 103}
98 104
99void IncSearchWidget::announceDoSearch() 105void IncSearchWidget::announceDoSearch()
100{ 106{
101 107
102 emit doSearch( mSearchText->text() ); 108 emit doSearch( mSearchText->text() );
103 // qDebug("emit dosreach "); 109 // qDebug("emit dosreach ");
104} 110}
105 111
106void IncSearchWidget::announceFieldChanged() 112void IncSearchWidget::announceFieldChanged()
107{ 113{
108 emit fieldChanged(); 114 emit fieldChanged();
109} 115}
110 116
111void IncSearchWidget::setFields( const KABC::Field::List &list ) 117void IncSearchWidget::setFields( const KABC::Field::List &list )
112{ 118{
113 119
114 mFieldCombo->clear(); 120 mFieldCombo->clear();
115 mFieldCombo->insertItem( i18n( "All Fields" ) ); 121 mFieldCombo->insertItem( i18n( "All Fields" ) );
116 QFontMetrics fm ( mFieldCombo->font() ); 122 QFontMetrics fm ( mFieldCombo->font() );
117 int wid = fm.width(i18n( "All Fields" ) ); 123 int wid = fm.width(i18n( "All Fields" ) );
118 int max = wid; 124 int max = wid;
119 125
120 KABC::Field::List::ConstIterator it; 126 KABC::Field::List::ConstIterator it;
121 for ( it = list.begin(); it != list.end(); ++it ) { 127 for ( it = list.begin(); it != list.end(); ++it ) {
122 mFieldCombo->insertItem( (*it)->label() ); 128 mFieldCombo->insertItem( (*it)->label() );
123 // wid = fm.width((*it)->label() ); 129 // wid = fm.width((*it)->label() );
124 //if ( wid > max ) 130 //if ( wid > max )
125 // max = wid; 131 // max = wid;
126 } 132 }
127 133
128 mFieldList = list; 134 mFieldList = list;
129 135
130 announceDoSearch(); 136 announceDoSearch();
131 announceFieldChanged(); 137 announceFieldChanged();