summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-02 13:25:49 (UTC)
committer alwin <alwin>2004-03-02 13:25:49 (UTC)
commitac3e7c0a1ccbb984f06917ebe6156b1681b7de7f (patch) (unidiff)
treedbfc670acbb2bee8032c1fa34b45948cf3b9631b
parentb6b1c97559c0ed9f2e33632272426bf98f289232 (diff)
downloadopie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.zip
opie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.tar.gz
opie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.tar.bz2
applied changes from optimize_connect script
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/qt3/opieui/ocombobox.cpp20
-rw-r--r--libopie2/qt3/opieui/ocompletionbox.cpp10
-rw-r--r--libopie2/qt3/opieui/ojanuswidget.cpp10
-rw-r--r--libopie2/qt3/opieui/olineedit.cpp24
4 files changed, 32 insertions, 32 deletions
diff --git a/libopie2/qt3/opieui/ocombobox.cpp b/libopie2/qt3/opieui/ocombobox.cpp
index 8dbda8f..bd330e0 100644
--- a/libopie2/qt3/opieui/ocombobox.cpp
+++ b/libopie2/qt3/opieui/ocombobox.cpp
@@ -283,110 +283,110 @@ void OComboBox::insertURL( const QPixmap& pixmap, const OURL& url, int index )
283 QComboBox::insertItem( pixmap, url.prettyURL(), index ); 283 QComboBox::insertItem( pixmap, url.prettyURL(), index );
284} 284}
285 285
286void OComboBox::changeURL( const OURL& url, int index ) 286void OComboBox::changeURL( const OURL& url, int index )
287{ 287{
288 QComboBox::changeItem( url.prettyURL(), index ); 288 QComboBox::changeItem( url.prettyURL(), index );
289} 289}
290 290
291void OComboBox::changeURL( const QPixmap& pixmap, const OURL& url, int index ) 291void OComboBox::changeURL( const QPixmap& pixmap, const OURL& url, int index )
292{ 292{
293 QComboBox::changeItem( pixmap, url.prettyURL(), index ); 293 QComboBox::changeItem( pixmap, url.prettyURL(), index );
294} 294}
295*/ 295*/
296 296
297 297
298void OComboBox::setCompletedItems( const QStringList& items ) 298void OComboBox::setCompletedItems( const QStringList& items )
299{ 299{
300 if ( d->olineEdit ) 300 if ( d->olineEdit )
301 d->olineEdit->setCompletedItems( items ); 301 d->olineEdit->setCompletedItems( items );
302} 302}
303 303
304 304
305OCompletionBox * OComboBox::completionBox( bool create ) 305OCompletionBox * OComboBox::completionBox( bool create )
306{ 306{
307 if ( d->olineEdit ) 307 if ( d->olineEdit )
308 return d->olineEdit->completionBox( create ); 308 return d->olineEdit->completionBox( create );
309 return 0; 309 return 0;
310} 310}
311 311
312// QWidget::create() turns off mouse-Tracking which would break auto-hiding 312// QWidget::create() turns off mouse-Tracking which would break auto-hiding
313void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) 313void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow )
314{ 314{
315 QComboBox::create( id, initializeWindow, destroyOldWindow ); 315 QComboBox::create( id, initializeWindow, destroyOldWindow );
316 //OCursor::setAutoHideCursor( lineEdit(), true, true ); 316 //OCursor::setAutoHideCursor( lineEdit(), true, true );
317} 317}
318 318
319void OComboBox::setLineEdit( OLineEdit *edit ) 319void OComboBox::setLineEdit( OLineEdit *edit )
320{ 320{
321 #if QT_VERSION > 290 321 #if QT_VERSION > 290
322 QComboBox::setLineEdit( edit ); 322 QComboBox::setLineEdit( edit );
323 if ( !edit->inherits( "OLineEdit" ) ) 323 if ( !edit->inherits( "OLineEdit" ) )
324 d->olineEdit = 0; 324 d->olineEdit = 0;
325 else 325 else
326 d->olineEdit = static_cast<OLineEdit*>( edit ); 326 d->olineEdit = static_cast<OLineEdit*>( edit );
327 setDelegate( d->olineEdit ); 327 setDelegate( d->olineEdit );
328 328
329 // forward some signals. We only emit returnPressed() ourselves. 329 // forward some signals. We only emit returnPressed() ourselves.
330 if ( d->olineEdit ) { 330 if ( d->olineEdit ) {
331 connect( d->olineEdit, SIGNAL( completion( const QString& )), 331 connect( d->olineEdit, SIGNAL( completion(const QString&)),
332 SIGNAL( completion( const QString& )) ); 332 SIGNAL( completion(const QString&)) );
333 connect( d->olineEdit, SIGNAL( substringCompletion( const QString& )), 333 connect( d->olineEdit, SIGNAL( substringCompletion(const QString&)),
334 SIGNAL( substringCompletion( const QString& )) ); 334 SIGNAL( substringCompletion(const QString&)) );
335 connect( d->olineEdit, 335 connect( d->olineEdit,
336 SIGNAL( textRotation( OCompletionBase::KeyBindingType )), 336 SIGNAL( textRotation(OCompletionBase::KeyBindingType)),
337 SIGNAL( textRotation( OCompletionBase::KeyBindingType )) ); 337 SIGNAL( textRotation(OCompletionBase::KeyBindingType)) );
338 connect( d->olineEdit, 338 connect( d->olineEdit,
339 SIGNAL( completionModeChanged( OGlobalSettings::Completion )), 339 SIGNAL( completionModeChanged(OGlobalSettings::Completion)),
340 SIGNAL( completionModeChanged( OGlobalSettings::Completion))); 340 SIGNAL( completionModeChanged(OGlobalSettings::Completion)));
341 341
342 connect( d->olineEdit, 342 connect( d->olineEdit,
343 SIGNAL( aboutToShowContextMenu( QPopupMenu * )), 343 SIGNAL( aboutToShowContextMenu(QPopupMenu*)),
344 SIGNAL( aboutToShowContextMenu( QPopupMenu * )) ); 344 SIGNAL( aboutToShowContextMenu(QPopupMenu*)) );
345 } 345 }
346 #else 346 #else
347 #warning OComboBox is not fully functional with Qt2 347 #warning OComboBox is not fully functional with Qt2
348 #endif 348 #endif
349} 349}
350 350
351// Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001 351// Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001
352void OComboBox::deleteWordForward() 352void OComboBox::deleteWordForward()
353{ 353{
354 lineEdit()->cursorWordForward(TRUE); 354 lineEdit()->cursorWordForward(TRUE);
355 #if QT_VERSION > 290 355 #if QT_VERSION > 290
356 if ( lineEdit()->hasSelectedText() ) 356 if ( lineEdit()->hasSelectedText() )
357 #else 357 #else
358 if ( lineEdit()->hasMarkedText() ) 358 if ( lineEdit()->hasMarkedText() )
359 #endif 359 #endif
360 { 360 {
361 lineEdit()->del(); 361 lineEdit()->del();
362 } 362 }
363} 363}
364 364
365void OComboBox::deleteWordBack() 365void OComboBox::deleteWordBack()
366{ 366{
367 lineEdit()->cursorWordBackward(TRUE); 367 lineEdit()->cursorWordBackward(TRUE);
368 #if QT_VERSION > 290 368 #if QT_VERSION > 290
369 if ( lineEdit()->hasSelectedText() ) 369 if ( lineEdit()->hasSelectedText() )
370 #else 370 #else
371 if ( lineEdit()->hasMarkedText() ) 371 if ( lineEdit()->hasMarkedText() )
372 #endif 372 #endif
373 { 373 {
374 lineEdit()->del(); 374 lineEdit()->del();
375 } 375 }
376} 376}
377 377
378void OComboBox::setCurrentItem( const QString& item, bool insert, int index ) 378void OComboBox::setCurrentItem( const QString& item, bool insert, int index )
379{ 379{
380 int sel = -1; 380 int sel = -1;
381 for (int i = 0; i < count(); ++i) 381 for (int i = 0; i < count(); ++i)
382 if (text(i) == item) 382 if (text(i) == item)
383 { 383 {
384 sel = i; 384 sel = i;
385 break; 385 break;
386 } 386 }
387 if (sel == -1 && insert) 387 if (sel == -1 && insert)
388 { 388 {
389 insertItem(item, index); 389 insertItem(item, index);
390 if (index >= 0) 390 if (index >= 0)
391 sel = index; 391 sel = index;
392 else 392 else
diff --git a/libopie2/qt3/opieui/ocompletionbox.cpp b/libopie2/qt3/opieui/ocompletionbox.cpp
index b594b8e..b36123e 100644
--- a/libopie2/qt3/opieui/ocompletionbox.cpp
+++ b/libopie2/qt3/opieui/ocompletionbox.cpp
@@ -22,104 +22,104 @@
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30 30
31*/ 31*/
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qevent.h> 34#include <qevent.h>
35#include <qstyle.h> 35#include <qstyle.h>
36 36
37#include <opie2/ocompletionbox.h> 37#include <opie2/ocompletionbox.h>
38 38
39#define OListBox QListBox 39#define OListBox QListBox
40 40
41class OCompletionBox::OCompletionBoxPrivate 41class OCompletionBox::OCompletionBoxPrivate
42{ 42{
43public: 43public:
44 QWidget *m_parent; // necessary to set the focus back 44 QWidget *m_parent; // necessary to set the focus back
45 QString cancelText; 45 QString cancelText;
46 bool tabHandling; 46 bool tabHandling;
47 bool down_workaround; 47 bool down_workaround;
48}; 48};
49 49
50OCompletionBox::OCompletionBox( QWidget *parent, const char *name ) 50OCompletionBox::OCompletionBox( QWidget *parent, const char *name )
51 :OListBox( parent, name, WType_Popup ) 51 :OListBox( parent, name, WType_Popup )
52{ 52{
53 d = new OCompletionBoxPrivate; 53 d = new OCompletionBoxPrivate;
54 d->m_parent = parent; 54 d->m_parent = parent;
55 d->tabHandling = true; 55 d->tabHandling = true;
56 d->down_workaround = false; 56 d->down_workaround = false;
57 57
58 setColumnMode( 1 ); 58 setColumnMode( 1 );
59 setLineWidth( 1 ); 59 setLineWidth( 1 );
60 setFrameStyle( QFrame::Box | QFrame::Plain ); 60 setFrameStyle( QFrame::Box | QFrame::Plain );
61 61
62 if ( parent ) 62 if ( parent )
63 setFocusProxy( parent ); 63 setFocusProxy( parent );
64 else 64 else
65 setFocusPolicy( NoFocus ); 65 setFocusPolicy( NoFocus );
66 66
67 setVScrollBarMode( Auto ); 67 setVScrollBarMode( Auto );
68 setHScrollBarMode( AlwaysOff ); 68 setHScrollBarMode( AlwaysOff );
69 69
70 connect( this, SIGNAL( doubleClicked( QListBoxItem * )), 70 connect( this, SIGNAL( doubleClicked(QListBoxItem*)),
71 SLOT( slotActivated( QListBoxItem * )) ); 71 SLOT( slotActivated(QListBoxItem*)) );
72 72
73 // grmbl, just QListBox workarounds :[ Thanks Volker. 73 // grmbl, just QListBox workarounds :[ Thanks Volker.
74 connect( this, SIGNAL( currentChanged( QListBoxItem * )), 74 connect( this, SIGNAL( currentChanged(QListBoxItem*)),
75 SLOT( slotCurrentChanged() )); 75 SLOT( slotCurrentChanged() ));
76 connect( this, SIGNAL( clicked( QListBoxItem * )), 76 connect( this, SIGNAL( clicked(QListBoxItem*)),
77 SLOT( slotItemClicked( QListBoxItem * )) ); 77 SLOT( slotItemClicked(QListBoxItem*)) );
78} 78}
79 79
80OCompletionBox::~OCompletionBox() 80OCompletionBox::~OCompletionBox()
81{ 81{
82 d->m_parent = 0L; 82 d->m_parent = 0L;
83 delete d; 83 delete d;
84} 84}
85 85
86QStringList OCompletionBox::items() const 86QStringList OCompletionBox::items() const
87{ 87{
88 QStringList list; 88 QStringList list;
89 for ( uint i = 0; i < count(); i++ ) { 89 for ( uint i = 0; i < count(); i++ ) {
90 list.append( text( i ) ); 90 list.append( text( i ) );
91 } 91 }
92 return list; 92 return list;
93} 93}
94 94
95void OCompletionBox::slotActivated( QListBoxItem *item ) 95void OCompletionBox::slotActivated( QListBoxItem *item )
96{ 96{
97 if ( !item ) 97 if ( !item )
98 return; 98 return;
99 99
100 hide(); 100 hide();
101 emit activated( item->text() ); 101 emit activated( item->text() );
102} 102}
103 103
104bool OCompletionBox::eventFilter( QObject *o, QEvent *e ) 104bool OCompletionBox::eventFilter( QObject *o, QEvent *e )
105{ 105{
106 int type = e->type(); 106 int type = e->type();
107 107
108 if ( o == d->m_parent ) { 108 if ( o == d->m_parent ) {
109 if ( isVisible() ) { 109 if ( isVisible() ) {
110 if ( type == QEvent::KeyPress ) { 110 if ( type == QEvent::KeyPress ) {
111 QKeyEvent *ev = static_cast<QKeyEvent *>( e ); 111 QKeyEvent *ev = static_cast<QKeyEvent *>( e );
112 switch ( ev->key() ) { 112 switch ( ev->key() ) {
113 case Key_BackTab: 113 case Key_BackTab:
114 if ( d->tabHandling ) { 114 if ( d->tabHandling ) {
115 up(); 115 up();
116 ev->accept(); 116 ev->accept();
117 return true; 117 return true;
118 } 118 }
119 break; 119 break;
120 case Key_Tab: 120 case Key_Tab:
121 if ( d->tabHandling ) { 121 if ( d->tabHandling ) {
122 down(); // Only on TAB!! 122 down(); // Only on TAB!!
123 ev->accept(); 123 ev->accept();
124 return true; 124 return true;
125 } 125 }
diff --git a/libopie2/qt3/opieui/ojanuswidget.cpp b/libopie2/qt3/opieui/ojanuswidget.cpp
index 0a037ff..063e393 100644
--- a/libopie2/qt3/opieui/ojanuswidget.cpp
+++ b/libopie2/qt3/opieui/ojanuswidget.cpp
@@ -64,148 +64,148 @@ class OJanusWidget::IconListItem : public QListBoxItem
64 public: 64 public:
65 IconListItem( QListBox *listbox, const QPixmap &pixmap, 65 IconListItem( QListBox *listbox, const QPixmap &pixmap,
66 const QString &text ); 66 const QString &text );
67 virtual int height( const QListBox *lb ) const; 67 virtual int height( const QListBox *lb ) const;
68 virtual int width( const QListBox *lb ) const; 68 virtual int width( const QListBox *lb ) const;
69 int expandMinimumWidth( int width ); 69 int expandMinimumWidth( int width );
70 70
71 protected: 71 protected:
72 const QPixmap &defaultPixmap(); 72 const QPixmap &defaultPixmap();
73 void paint( QPainter *painter ); 73 void paint( QPainter *painter );
74 74
75 private: 75 private:
76 QPixmap mPixmap; 76 QPixmap mPixmap;
77 int mMinimumWidth; 77 int mMinimumWidth;
78}; 78};
79 79
80template class QPtrList<QListViewItem>; 80template class QPtrList<QListViewItem>;
81 81
82/*====================================================================================== 82/*======================================================================================
83 * OJanusWidget 83 * OJanusWidget
84 *======================================================================================*/ 84 *======================================================================================*/
85 85
86OJanusWidget::OJanusWidget( QWidget *parent, const char *name, int face ) 86OJanusWidget::OJanusWidget( QWidget *parent, const char *name, int face )
87 : QWidget( parent, name, 0 ), 87 : QWidget( parent, name, 0 ),
88 mValid(false), mPageList(0), 88 mValid(false), mPageList(0),
89 mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), 89 mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0),
90 mShowIconsInTreeList(false), d(0) 90 mShowIconsInTreeList(false), d(0)
91{ 91{
92 QVBoxLayout *topLayout = new QVBoxLayout( this ); 92 QVBoxLayout *topLayout = new QVBoxLayout( this );
93 93
94 if( mFace == TreeList || mFace == IconList ) 94 if( mFace == TreeList || mFace == IconList )
95 { 95 {
96 mPageList = new QPtrList<QWidget>; 96 mPageList = new QPtrList<QWidget>;
97 mTitleList = new QStringList(); 97 mTitleList = new QStringList();
98 98
99 QFrame *page; 99 QFrame *page;
100 if( mFace == TreeList ) 100 if( mFace == TreeList )
101 { 101 {
102 QSplitter *splitter = new QSplitter( this ); 102 QSplitter *splitter = new QSplitter( this );
103 topLayout->addWidget( splitter, 10 ); 103 topLayout->addWidget( splitter, 10 );
104 mTreeListResizeMode = QSplitter::KeepSize; 104 mTreeListResizeMode = QSplitter::KeepSize;
105 105
106 mTreeList = new QListView( splitter ); 106 mTreeList = new QListView( splitter );
107 mTreeList->addColumn( QString::fromLatin1("") ); 107 mTreeList->addColumn( QString::fromLatin1("") );
108 mTreeList->header()->hide(); 108 mTreeList->header()->hide();
109 mTreeList->setRootIsDecorated(true); 109 mTreeList->setRootIsDecorated(true);
110 mTreeList->setSorting( -1 ); 110 mTreeList->setSorting( -1 );
111 connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) ); 111 connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) );
112 connect( mTreeList, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *))); 112 connect( mTreeList, SIGNAL(clicked(QListViewItem*)), SLOT(slotItemClicked(QListViewItem*)));
113 113
114 // 114 //
115 // Page area. Title at top with a separator below and a pagestack using 115 // Page area. Title at top with a separator below and a pagestack using
116 // all available space at bottom. 116 // all available space at bottom.
117 // 117 //
118 QFrame *p = new QFrame( splitter ); 118 QFrame *p = new QFrame( splitter );
119 119
120 QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 ); 120 QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 );
121 hbox->addSpacing( ODialog::spacingHint() ); 121 hbox->addSpacing( ODialog::spacingHint() );
122 122
123 page = new QFrame( p ); 123 page = new QFrame( p );
124 hbox->addWidget( page, 10 ); 124 hbox->addWidget( page, 10 );
125 } 125 }
126 else 126 else
127 { 127 {
128 QHBoxLayout *hbox = new QHBoxLayout( topLayout ); 128 QHBoxLayout *hbox = new QHBoxLayout( topLayout );
129 mIconList = new IconListBox( this ); 129 mIconList = new IconListBox( this );
130 130
131 QFont listFont( mIconList->font() ); 131 QFont listFont( mIconList->font() );
132 listFont.setBold( true ); 132 listFont.setBold( true );
133 mIconList->setFont( listFont ); 133 mIconList->setFont( listFont );
134 134
135 mIconList->verticalScrollBar()->installEventFilter( this ); 135 mIconList->verticalScrollBar()->installEventFilter( this );
136 hbox->addWidget( mIconList ); 136 hbox->addWidget( mIconList );
137 connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); 137 connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage()));
138 hbox->addSpacing( ODialog::spacingHint() ); 138 hbox->addSpacing( ODialog::spacingHint() );
139 page = new QFrame( this ); 139 page = new QFrame( this );
140 hbox->addWidget( page, 10 ); 140 hbox->addWidget( page, 10 );
141 } 141 }
142 142
143 // 143 //
144 // Rest of page area. Title at top with a separator below and a 144 // Rest of page area. Title at top with a separator below and a
145 // pagestack using all available space at bottom. 145 // pagestack using all available space at bottom.
146 // 146 //
147 147
148 QVBoxLayout *vbox = new QVBoxLayout( page, 0, ODialog::spacingHint() ); 148 QVBoxLayout *vbox = new QVBoxLayout( page, 0, ODialog::spacingHint() );
149 149
150 mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "OJanusWidgetTitleLabel" ); 150 mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "OJanusWidgetTitleLabel" );
151 vbox->addWidget( mTitleLabel ); 151 vbox->addWidget( mTitleLabel );
152 152
153 QFont titleFont( mTitleLabel->font() ); 153 QFont titleFont( mTitleLabel->font() );
154 titleFont.setBold( true ); 154 titleFont.setBold( true );
155 mTitleLabel->setFont( titleFont ); 155 mTitleLabel->setFont( titleFont );
156 156
157 mTitleSep = new OSeparator( page ); 157 mTitleSep = new OSeparator( page );
158 mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain ); 158 mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain );
159 vbox->addWidget( mTitleSep ); 159 vbox->addWidget( mTitleSep );
160 160
161 mPageStack = new QWidgetStack( page ); 161 mPageStack = new QWidgetStack( page );
162 connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), 162 connect(mPageStack, SIGNAL(aboutToShow(QWidget*)),
163 this, SIGNAL(aboutToShowPage(QWidget *))); 163 this, SIGNAL(aboutToShowPage(QWidget*)));
164 vbox->addWidget( mPageStack, 10 ); 164 vbox->addWidget( mPageStack, 10 );
165 } 165 }
166 else if( mFace == Tabbed ) 166 else if( mFace == Tabbed )
167 { 167 {
168 mPageList = new QPtrList<QWidget>; 168 mPageList = new QPtrList<QWidget>;
169 169
170 mTabControl = new QTabWidget( this ); 170 mTabControl = new QTabWidget( this );
171 mTabControl->setMargin (ODialog::marginHint()); 171 mTabControl->setMargin (ODialog::marginHint());
172 topLayout->addWidget( mTabControl, 10 ); 172 topLayout->addWidget( mTabControl, 10 );
173 } 173 }
174 else if( mFace == Swallow ) 174 else if( mFace == Swallow )
175 { 175 {
176 mSwallowPage = new QWidget( this ); 176 mSwallowPage = new QWidget( this );
177 topLayout->addWidget( mSwallowPage, 10 ); 177 topLayout->addWidget( mSwallowPage, 10 );
178 } 178 }
179 else 179 else
180 { 180 {
181 mFace = Plain; 181 mFace = Plain;
182 mPlainPage = new QFrame( this ); 182 mPlainPage = new QFrame( this );
183 topLayout->addWidget( mPlainPage, 10 ); 183 topLayout->addWidget( mPlainPage, 10 );
184 } 184 }
185 185
186 /* FIXME: Revise for Opie 186 /* FIXME: Revise for Opie
187 if ( kapp ) 187 if ( kapp )
188 connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged())); 188 connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged()));
189 */ 189 */
190 190
191 mValid = true; 191 mValid = true;
192 192
193 setSwallowedWidget(0); // Set default size if 'mFace' is Swallow. 193 setSwallowedWidget(0); // Set default size if 'mFace' is Swallow.
194} 194}
195 195
196 196
197OJanusWidget::~OJanusWidget() 197OJanusWidget::~OJanusWidget()
198{ 198{
199 delete mPageList; 199 delete mPageList;
200 mPageList = 0; 200 mPageList = 0;
201 delete mTitleList; 201 delete mTitleList;
202 mTitleList = 0; 202 mTitleList = 0;
203} 203}
204 204
205 205
206bool OJanusWidget::isValid() const 206bool OJanusWidget::isValid() const
207{ 207{
208 return( mValid ); 208 return( mValid );
209} 209}
210 210
211 211
@@ -818,99 +818,99 @@ QSize OJanusWidget::minimumSizeHint() const
818 } 818 }
819 819
820} 820}
821 821
822 822
823QSize OJanusWidget::sizeHint() const 823QSize OJanusWidget::sizeHint() const
824{ 824{
825 return( minimumSizeHint() ); 825 return( minimumSizeHint() );
826} 826}
827 827
828 828
829void OJanusWidget::setTreeListAutoResize( bool state ) 829void OJanusWidget::setTreeListAutoResize( bool state )
830{ 830{
831 if( mFace == TreeList ) 831 if( mFace == TreeList )
832 { 832 {
833 mTreeListResizeMode = state == false ? 833 mTreeListResizeMode = state == false ?
834 QSplitter::KeepSize : QSplitter::Stretch; 834 QSplitter::KeepSize : QSplitter::Stretch;
835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
836 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 836 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
837 } 837 }
838} 838}
839 839
840 840
841void OJanusWidget::setIconListAllVisible( bool state ) 841void OJanusWidget::setIconListAllVisible( bool state )
842{ 842{
843 if( mFace == IconList ) 843 if( mFace == IconList )
844 { 844 {
845 mIconList->setShowAll( state ); 845 mIconList->setShowAll( state );
846 } 846 }
847} 847}
848 848
849void OJanusWidget::setShowIconsInTreeList( bool state ) 849void OJanusWidget::setShowIconsInTreeList( bool state )
850{ 850{
851 mShowIconsInTreeList = state; 851 mShowIconsInTreeList = state;
852} 852}
853 853
854void OJanusWidget::setRootIsDecorated( bool state ) 854void OJanusWidget::setRootIsDecorated( bool state )
855{ 855{
856 if( mFace == TreeList ) { 856 if( mFace == TreeList ) {
857 mTreeList->setRootIsDecorated(state); 857 mTreeList->setRootIsDecorated(state);
858 } 858 }
859} 859}
860 860
861void OJanusWidget::unfoldTreeList( bool persist ) 861void OJanusWidget::unfoldTreeList( bool persist )
862{ 862{
863 if( mFace == TreeList ) 863 if( mFace == TreeList )
864 { 864 {
865 if( persist ) 865 if( persist )
866 connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); 866 connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
867 else 867 else
868 disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); 868 disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
869 869
870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) 870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
871 item->setOpen( true ); 871 item->setOpen( true );
872 } 872 }
873} 873}
874 874
875void OJanusWidget::showEvent( QShowEvent * ) 875void OJanusWidget::showEvent( QShowEvent * )
876{ 876{
877 if( mFace == TreeList ) 877 if( mFace == TreeList )
878 { 878 {
879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
880 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 880 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
881 } 881 }
882} 882}
883 883
884 884
885// 885//
886// 2000-13-02 Espen Sand 886// 2000-13-02 Espen Sand
887// It should be obvious that this eventfilter must only be 887// It should be obvious that this eventfilter must only be
888// be installed on the vertical scrollbar of the mIconList. 888// be installed on the vertical scrollbar of the mIconList.
889// 889//
890bool OJanusWidget::eventFilter( QObject *o, QEvent *e ) 890bool OJanusWidget::eventFilter( QObject *o, QEvent *e )
891{ 891{
892 if( e->type() == QEvent::Show ) 892 if( e->type() == QEvent::Show )
893 { 893 {
894 IconListItem *item = (IconListItem*)mIconList->item(0); 894 IconListItem *item = (IconListItem*)mIconList->item(0);
895 if( item != 0 ) 895 if( item != 0 )
896 { 896 {
897 int lw = item->width( mIconList ); 897 int lw = item->width( mIconList );
898 int sw = mIconList->verticalScrollBar()->sizeHint().width(); 898 int sw = mIconList->verticalScrollBar()->sizeHint().width();
899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 ); 899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
900 } 900 }
901 } 901 }
902 else if( e->type() == QEvent::Hide ) 902 else if( e->type() == QEvent::Hide )
903 { 903 {
904 IconListItem *item = (IconListItem*)mIconList->item(0); 904 IconListItem *item = (IconListItem*)mIconList->item(0);
905 if( item != 0 ) 905 if( item != 0 )
906 { 906 {
907 int lw = item->width( mIconList ); 907 int lw = item->width( mIconList );
908 mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 ); 908 mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 );
909 } 909 }
910 } 910 }
911 return QWidget::eventFilter( o, e ); 911 return QWidget::eventFilter( o, e );
912} 912}
913 913
914 914
915 915
916// 916//
diff --git a/libopie2/qt3/opieui/olineedit.cpp b/libopie2/qt3/opieui/olineedit.cpp
index 9cb0cff..6f66fc7 100644
--- a/libopie2/qt3/opieui/olineedit.cpp
+++ b/libopie2/qt3/opieui/olineedit.cpp
@@ -402,98 +402,98 @@ void OLineEdit::keyPressEvent( QKeyEvent *e )
402 402
403 // Let QLineEdit handle any other keys events. 403 // Let QLineEdit handle any other keys events.
404 QLineEdit::keyPressEvent ( e ); 404 QLineEdit::keyPressEvent ( e );
405} 405}
406 406
407void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e ) 407void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e )
408{ 408{
409 if ( e->button() == Qt::LeftButton ) 409 if ( e->button() == Qt::LeftButton )
410 { 410 {
411 possibleTripleClick=true; 411 possibleTripleClick=true;
412 QTimer::singleShot( QApplication::doubleClickInterval(),this, 412 QTimer::singleShot( QApplication::doubleClickInterval(),this,
413 SLOT(tripleClickTimeout()) ); 413 SLOT(tripleClickTimeout()) );
414 } 414 }
415 QLineEdit::mouseDoubleClickEvent( e ); 415 QLineEdit::mouseDoubleClickEvent( e );
416} 416}
417 417
418void OLineEdit::mousePressEvent( QMouseEvent* e ) 418void OLineEdit::mousePressEvent( QMouseEvent* e )
419{ 419{
420 if ( possibleTripleClick && e->button() == Qt::LeftButton ) 420 if ( possibleTripleClick && e->button() == Qt::LeftButton )
421 { 421 {
422 selectAll(); 422 selectAll();
423 return; 423 return;
424 } 424 }
425 QLineEdit::mousePressEvent( e ); 425 QLineEdit::mousePressEvent( e );
426} 426}
427 427
428void OLineEdit::tripleClickTimeout() 428void OLineEdit::tripleClickTimeout()
429{ 429{
430 possibleTripleClick=false; 430 possibleTripleClick=false;
431} 431}
432 432
433QPopupMenu *OLineEdit::createPopupMenu() 433QPopupMenu *OLineEdit::createPopupMenu()
434{ 434{
435 // Return if popup menu is not enabled !! 435 // Return if popup menu is not enabled !!
436 if ( !m_bEnableMenu ) 436 if ( !m_bEnableMenu )
437 return 0; 437 return 0;
438 438
439 #if QT_VERSION > 290 439 #if QT_VERSION > 290
440 QPopupMenu *popup = QLineEdit::createPopupMenu(); 440 QPopupMenu *popup = QLineEdit::createPopupMenu();
441 #else 441 #else
442 QPopupMenu *popup = new QPopupMenu(); 442 QPopupMenu *popup = new QPopupMenu();
443 #warning OLineEdit is not fully functional on Qt2 443 #warning OLineEdit is not fully functional on Qt2
444 #endif 444 #endif
445 445
446 // completion object is present. 446 // completion object is present.
447 if ( compObj() ) 447 if ( compObj() )
448 { 448 {
449 QPopupMenu *subMenu = new QPopupMenu( popup ); 449 QPopupMenu *subMenu = new QPopupMenu( popup );
450 connect( subMenu, SIGNAL( activated( int ) ), 450 connect( subMenu, SIGNAL( activated(int) ),
451 this, SLOT( completionMenuActivated( int ) ) ); 451 this, SLOT( completionMenuActivated(int) ) );
452 452
453 popup->insertSeparator(); 453 popup->insertSeparator();
454 //popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"), 454 //popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
455 // subMenu ); 455 // subMenu );
456 456
457 popup->insertItem( tr("Text Completion"), subMenu ); 457 popup->insertItem( tr("Text Completion"), subMenu );
458 458
459 subMenu->insertItem( tr("None"), NoCompletion ); 459 subMenu->insertItem( tr("None"), NoCompletion );
460 subMenu->insertItem( tr("Manual"), ShellCompletion ); 460 subMenu->insertItem( tr("Manual"), ShellCompletion );
461 subMenu->insertItem( tr("Automatic"), AutoCompletion ); 461 subMenu->insertItem( tr("Automatic"), AutoCompletion );
462 subMenu->insertItem( tr("Dropdown List"), PopupCompletion ); 462 subMenu->insertItem( tr("Dropdown List"), PopupCompletion );
463 subMenu->insertItem( tr("Short Automatic"), SemiAutoCompletion ); 463 subMenu->insertItem( tr("Short Automatic"), SemiAutoCompletion );
464 464
465 //subMenu->setAccel( KStdAccel::completion(), ShellCompletion ); 465 //subMenu->setAccel( KStdAccel::completion(), ShellCompletion );
466 subMenu->setAccel( Key_Tab, ShellCompletion ); 466 subMenu->setAccel( Key_Tab, ShellCompletion );
467 467
468 OGlobalSettings::Completion mode = completionMode(); 468 OGlobalSettings::Completion mode = completionMode();
469 subMenu->setItemChecked( NoCompletion, 469 subMenu->setItemChecked( NoCompletion,
470 mode == OGlobalSettings::CompletionNone ); 470 mode == OGlobalSettings::CompletionNone );
471 subMenu->setItemChecked( ShellCompletion, 471 subMenu->setItemChecked( ShellCompletion,
472 mode == OGlobalSettings::CompletionShell ); 472 mode == OGlobalSettings::CompletionShell );
473 subMenu->setItemChecked( PopupCompletion, 473 subMenu->setItemChecked( PopupCompletion,
474 mode == OGlobalSettings::CompletionPopup ); 474 mode == OGlobalSettings::CompletionPopup );
475 subMenu->setItemChecked( AutoCompletion, 475 subMenu->setItemChecked( AutoCompletion,
476 mode == OGlobalSettings::CompletionAuto ); 476 mode == OGlobalSettings::CompletionAuto );
477 subMenu->setItemChecked( SemiAutoCompletion, 477 subMenu->setItemChecked( SemiAutoCompletion,
478 mode == OGlobalSettings::CompletionMan ); 478 mode == OGlobalSettings::CompletionMan );
479 if ( mode != OGlobalSettings::completionMode() ) 479 if ( mode != OGlobalSettings::completionMode() )
480 { 480 {
481 subMenu->insertSeparator(); 481 subMenu->insertSeparator();
482 subMenu->insertItem( tr("Default"), Default ); 482 subMenu->insertItem( tr("Default"), Default );
483 } 483 }
484 } 484 }
485 // ### do we really need this? Yes, Please do not remove! This 485 // ### do we really need this? Yes, Please do not remove! This
486 // allows applications to extend the popup menu without having to 486 // allows applications to extend the popup menu without having to
487 // inherit from this class! (DA) 487 // inherit from this class! (DA)
488 emit aboutToShowContextMenu( popup ); 488 emit aboutToShowContextMenu( popup );
489 489
490 return popup; 490 return popup;
491} 491}
492 492
493void OLineEdit::completionMenuActivated( int id ) 493void OLineEdit::completionMenuActivated( int id )
494{ 494{
495 OGlobalSettings::Completion oldMode = completionMode(); 495 OGlobalSettings::Completion oldMode = completionMode();
496 496
497 switch ( id ) 497 switch ( id )
498 { 498 {
499 case Default: 499 case Default:
@@ -571,159 +571,159 @@ bool OLineEdit::eventFilter( QObject* o, QEvent* ev )
571 571
572 emit returnPressed( displayText() ); 572 emit returnPressed( displayText() );
573 573
574 if ( trap ) 574 if ( trap )
575 d->completionBox->hide(); 575 d->completionBox->hide();
576 576
577 // Eat the event if the user asked for it, or if a completionbox was visible 577 // Eat the event if the user asked for it, or if a completionbox was visible
578 return d->grabReturnKeyEvents || trap; 578 return d->grabReturnKeyEvents || trap;
579 } 579 }
580 } 580 }
581 } 581 }
582 return QLineEdit::eventFilter( o, ev ); 582 return QLineEdit::eventFilter( o, ev );
583} 583}
584 584
585 585
586void OLineEdit::setURLDropsEnabled(bool enable) 586void OLineEdit::setURLDropsEnabled(bool enable)
587{ 587{
588 d->handleURLDrops=enable; 588 d->handleURLDrops=enable;
589} 589}
590 590
591bool OLineEdit::isURLDropsEnabled() const 591bool OLineEdit::isURLDropsEnabled() const
592{ 592{
593 return d->handleURLDrops; 593 return d->handleURLDrops;
594} 594}
595 595
596void OLineEdit::setTrapReturnKey( bool grab ) 596void OLineEdit::setTrapReturnKey( bool grab )
597{ 597{
598 d->grabReturnKeyEvents = grab; 598 d->grabReturnKeyEvents = grab;
599} 599}
600 600
601bool OLineEdit::trapReturnKey() const 601bool OLineEdit::trapReturnKey() const
602{ 602{
603 return d->grabReturnKeyEvents; 603 return d->grabReturnKeyEvents;
604} 604}
605 605
606/*void OLineEdit::setURL( const KURL& url ) 606/*void OLineEdit::setURL( const KURL& url )
607{ 607{
608 QLineEdit::setText( url.prettyURL() ); 608 QLineEdit::setText( url.prettyURL() );
609}*/ 609}*/
610 610
611void OLineEdit::makeCompletionBox() 611void OLineEdit::makeCompletionBox()
612{ 612{
613 if ( d->completionBox ) 613 if ( d->completionBox )
614 return; 614 return;
615 615
616 d->completionBox = new OCompletionBox( this, "completion box" ); 616 d->completionBox = new OCompletionBox( this, "completion box" );
617 if ( handleSignals() ) 617 if ( handleSignals() )
618 { 618 {
619 connect( d->completionBox, SIGNAL(highlighted( const QString& )), 619 connect( d->completionBox, SIGNAL(highlighted(const QString&)),
620 SLOT(setText( const QString& )) ); 620 SLOT(setText(const QString&)) );
621 connect( d->completionBox, SIGNAL(userCancelled( const QString& )), 621 connect( d->completionBox, SIGNAL(userCancelled(const QString&)),
622 SLOT(setText( const QString& )) ); 622 SLOT(setText(const QString&)) );
623 623
624 // Nice lil' hacklet ;) KComboBox doesn't know when the completionbox 624 // Nice lil' hacklet ;) KComboBox doesn't know when the completionbox
625 // is created (childEvent() is even more hacky, IMHO), so we simply 625 // is created (childEvent() is even more hacky, IMHO), so we simply
626 // forward the completionbox' activated signal from here. 626 // forward the completionbox' activated signal from here.
627 if ( parentWidget() && parentWidget()->inherits("KComboBox") ) 627 if ( parentWidget() && parentWidget()->inherits("KComboBox") )
628 connect( d->completionBox, SIGNAL( activated( const QString& )), 628 connect( d->completionBox, SIGNAL( activated(const QString&)),
629 parentWidget(), SIGNAL( activated( const QString & ))); 629 parentWidget(), SIGNAL( activated(const QString&)));
630 } 630 }
631} 631}
632 632
633/*bool OLineEdit::overrideAccel (const QKeyEvent* e) 633/*bool OLineEdit::overrideAccel (const QKeyEvent* e)
634{ 634{
635 KShortcut scKey; 635 KShortcut scKey;
636 636
637 KKey key( e ); 637 KKey key( e );
638 KeyBindingMap keys = getKeyBindings(); 638 KeyBindingMap keys = getKeyBindings();
639 639
640 if (keys[TextCompletion].isNull()) 640 if (keys[TextCompletion].isNull())
641 scKey = KStdAccel::shortcut(KStdAccel::TextCompletion); 641 scKey = KStdAccel::shortcut(KStdAccel::TextCompletion);
642 else 642 else
643 scKey = keys[TextCompletion]; 643 scKey = keys[TextCompletion];
644 644
645 if (scKey.contains( key )) 645 if (scKey.contains( key ))
646 return true; 646 return true;
647 647
648 if (keys[NextCompletionMatch].isNull()) 648 if (keys[NextCompletionMatch].isNull())
649 scKey = KStdAccel::shortcut(KStdAccel::NextCompletion); 649 scKey = KStdAccel::shortcut(KStdAccel::NextCompletion);
650 else 650 else
651 scKey = keys[NextCompletionMatch]; 651 scKey = keys[NextCompletionMatch];
652 652
653 if (scKey.contains( key )) 653 if (scKey.contains( key ))
654 return true; 654 return true;
655 655
656 if (keys[PrevCompletionMatch].isNull()) 656 if (keys[PrevCompletionMatch].isNull())
657 scKey = KStdAccel::shortcut(KStdAccel::PrevCompletion); 657 scKey = KStdAccel::shortcut(KStdAccel::PrevCompletion);
658 else 658 else
659 scKey = keys[PrevCompletionMatch]; 659 scKey = keys[PrevCompletionMatch];
660 660
661 if (scKey.contains( key )) 661 if (scKey.contains( key ))
662 return true; 662 return true;
663 663
664 if (KStdAccel::deleteWordBack().contains( key )) 664 if (KStdAccel::deleteWordBack().contains( key ))
665 return true; 665 return true;
666 if (KStdAccel::deleteWordForward().contains( key )) 666 if (KStdAccel::deleteWordForward().contains( key ))
667 return true; 667 return true;
668 668
669 if (d->completionBox && d->completionBox->isVisible ()) 669 if (d->completionBox && d->completionBox->isVisible ())
670 if (e->key () == Key_Backtab) 670 if (e->key () == Key_Backtab)
671 return true; 671 return true;
672 672
673 return false; 673 return false;
674}*/ 674}*/
675 675
676void OLineEdit::setCompletedItems( const QStringList& items ) 676void OLineEdit::setCompletedItems( const QStringList& items )
677{ 677{
678 QString txt = text(); 678 QString txt = text();
679 if ( !items.isEmpty() && 679 if ( !items.isEmpty() &&
680 !(items.count() == 1 && txt == items.first()) ) 680 !(items.count() == 1 && txt == items.first()) )
681 { 681 {
682 if ( !d->completionBox ) 682 if ( !d->completionBox )
683 makeCompletionBox(); 683 makeCompletionBox();
684 684
685 if ( !txt.isEmpty() ) 685 if ( !txt.isEmpty() )
686 d->completionBox->setCancelledText( txt ); 686 d->completionBox->setCancelledText( txt );
687 d->completionBox->setItems( items ); 687 d->completionBox->setItems( items );
688 d->completionBox->popup(); 688 d->completionBox->popup();
689 } 689 }
690 else 690 else
691 { 691 {
692 if ( d->completionBox && d->completionBox->isVisible() ) 692 if ( d->completionBox && d->completionBox->isVisible() )
693 d->completionBox->hide(); 693 d->completionBox->hide();
694 } 694 }
695} 695}
696 696
697OCompletionBox * OLineEdit::completionBox( bool create ) 697OCompletionBox * OLineEdit::completionBox( bool create )
698{ 698{
699 if ( create ) 699 if ( create )
700 makeCompletionBox(); 700 makeCompletionBox();
701 701
702 return d->completionBox; 702 return d->completionBox;
703} 703}
704 704
705void OLineEdit::setCompletionObject( OCompletion* comp, bool hsig ) 705void OLineEdit::setCompletionObject( OCompletion* comp, bool hsig )
706{ 706{
707 OCompletion *oldComp = compObj(); 707 OCompletion *oldComp = compObj();
708 if ( oldComp && handleSignals() ) 708 if ( oldComp && handleSignals() )
709 disconnect( oldComp, SIGNAL( matches( const QStringList& )), 709 disconnect( oldComp, SIGNAL( matches(const QStringList&)),
710 this, SLOT( setCompletedItems( const QStringList& ))); 710 this, SLOT( setCompletedItems(const QStringList&)));
711 711
712 if ( comp && hsig ) 712 if ( comp && hsig )
713 connect( comp, SIGNAL( matches( const QStringList& )), 713 connect( comp, SIGNAL( matches(const QStringList&)),
714 this, SLOT( setCompletedItems( const QStringList& ))); 714 this, SLOT( setCompletedItems(const QStringList&)));
715 715
716 OCompletionBase::setCompletionObject( comp, hsig ); 716 OCompletionBase::setCompletionObject( comp, hsig );
717} 717}
718 718
719// QWidget::create() turns off mouse-Tracking which would break auto-hiding 719// QWidget::create() turns off mouse-Tracking which would break auto-hiding
720void OLineEdit::create( WId id, bool initializeWindow, bool destroyOldWindow ) 720void OLineEdit::create( WId id, bool initializeWindow, bool destroyOldWindow )
721{ 721{
722 QLineEdit::create( id, initializeWindow, destroyOldWindow ); 722 QLineEdit::create( id, initializeWindow, destroyOldWindow );
723 //OCursor::setAutoHideCursor( this, true, true ); 723 //OCursor::setAutoHideCursor( this, true, true );
724} 724}
725 725
726void OLineEdit::clear() 726void OLineEdit::clear()
727{ 727{
728 setText( QString::null ); 728 setText( QString::null );
729} 729}