author | alwin <alwin> | 2004-03-02 13:25:49 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 13:25:49 (UTC) |
commit | ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f (patch) (unidiff) | |
tree | dbfc670acbb2bee8032c1fa34b45948cf3b9631b /libopie2/qt3 | |
parent | b6b1c97559c0ed9f2e33632272426bf98f289232 (diff) | |
download | opie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.zip opie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.tar.gz opie-ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f.tar.bz2 |
applied changes from optimize_connect script
-rw-r--r-- | libopie2/qt3/opieui/ocombobox.cpp | 20 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ocompletionbox.cpp | 10 | ||||
-rw-r--r-- | libopie2/qt3/opieui/ojanuswidget.cpp | 10 | ||||
-rw-r--r-- | libopie2/qt3/opieui/olineedit.cpp | 24 |
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 | |||
@@ -307,62 +307,62 @@ OCompletionBox * OComboBox::completionBox( bool create ) | |||
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 |
313 | void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) | 313 | void 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 | ||
319 | void OComboBox::setLineEdit( OLineEdit *edit ) | 319 | void 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 |
352 | void OComboBox::deleteWordForward() | 352 | void 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 | ||
365 | void OComboBox::deleteWordBack() | 365 | void OComboBox::deleteWordBack() |
366 | { | 366 | { |
367 | lineEdit()->cursorWordBackward(TRUE); | 367 | lineEdit()->cursorWordBackward(TRUE); |
368 | #if QT_VERSION > 290 | 368 | #if QT_VERSION > 290 |
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 | |||
@@ -46,56 +46,56 @@ public: | |||
46 | bool tabHandling; | 46 | bool tabHandling; |
47 | bool down_workaround; | 47 | bool down_workaround; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | OCompletionBox::OCompletionBox( QWidget *parent, const char *name ) | 50 | OCompletionBox::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 | ||
80 | OCompletionBox::~OCompletionBox() | 80 | OCompletionBox::~OCompletionBox() |
81 | { | 81 | { |
82 | d->m_parent = 0L; | 82 | d->m_parent = 0L; |
83 | delete d; | 83 | delete d; |
84 | } | 84 | } |
85 | 85 | ||
86 | QStringList OCompletionBox::items() const | 86 | QStringList 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 | ||
95 | void OCompletionBox::slotActivated( QListBoxItem *item ) | 95 | void 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() ); |
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 | |||
@@ -88,49 +88,49 @@ OJanusWidget::OJanusWidget( QWidget *parent, const char *name, int face ) | |||
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 ); |
@@ -138,50 +138,50 @@ OJanusWidget::OJanusWidget( QWidget *parent, const char *name, int face ) | |||
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 ) |
@@ -842,51 +842,51 @@ void 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 | ||
849 | void OJanusWidget::setShowIconsInTreeList( bool state ) | 849 | void OJanusWidget::setShowIconsInTreeList( bool state ) |
850 | { | 850 | { |
851 | mShowIconsInTreeList = state; | 851 | mShowIconsInTreeList = state; |
852 | } | 852 | } |
853 | 853 | ||
854 | void OJanusWidget::setRootIsDecorated( bool state ) | 854 | void 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 | ||
861 | void OJanusWidget::unfoldTreeList( bool persist ) | 861 | void 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 | ||
875 | void OJanusWidget::showEvent( QShowEvent * ) | 875 | void 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 | // |
890 | bool OJanusWidget::eventFilter( QObject *o, QEvent *e ) | 890 | bool OJanusWidget::eventFilter( QObject *o, QEvent *e ) |
891 | { | 891 | { |
892 | if( e->type() == QEvent::Show ) | 892 | if( e->type() == QEvent::Show ) |
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 | |||
@@ -426,50 +426,50 @@ void OLineEdit::mousePressEvent( QMouseEvent* e ) | |||
426 | } | 426 | } |
427 | 427 | ||
428 | void OLineEdit::tripleClickTimeout() | 428 | void OLineEdit::tripleClickTimeout() |
429 | { | 429 | { |
430 | possibleTripleClick=false; | 430 | possibleTripleClick=false; |
431 | } | 431 | } |
432 | 432 | ||
433 | QPopupMenu *OLineEdit::createPopupMenu() | 433 | QPopupMenu *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, |
@@ -595,59 +595,59 @@ bool OLineEdit::isURLDropsEnabled() const | |||
595 | 595 | ||
596 | void OLineEdit::setTrapReturnKey( bool grab ) | 596 | void OLineEdit::setTrapReturnKey( bool grab ) |
597 | { | 597 | { |
598 | d->grabReturnKeyEvents = grab; | 598 | d->grabReturnKeyEvents = grab; |
599 | } | 599 | } |
600 | 600 | ||
601 | bool OLineEdit::trapReturnKey() const | 601 | bool 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 | ||
611 | void OLineEdit::makeCompletionBox() | 611 | void 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 )) |
@@ -685,45 +685,45 @@ void OLineEdit::setCompletedItems( const QStringList& items ) | |||
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 | ||
697 | OCompletionBox * OLineEdit::completionBox( bool create ) | 697 | OCompletionBox * 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 | ||
705 | void OLineEdit::setCompletionObject( OCompletion* comp, bool hsig ) | 705 | void 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 |
720 | void OLineEdit::create( WId id, bool initializeWindow, bool destroyOldWindow ) | 720 | void 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 | ||
726 | void OLineEdit::clear() | 726 | void OLineEdit::clear() |
727 | { | 727 | { |
728 | setText( QString::null ); | 728 | setText( QString::null ); |
729 | } | 729 | } |