summaryrefslogtreecommitdiff
path: root/core/pim/osearch/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/osearch/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/mainwindow.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index c6934db..aa52061 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -21,2 +21,3 @@
#include <qhbuttongroup.h>
+#include <qhbox.h>
#include <qpushbutton.h>
@@ -25,2 +26,3 @@
#include <qlineedit.h>
+#include <qsignalmapper.h>
#include <qtextbrowser.h>
@@ -73,11 +75,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
- buttonGroupActions = new QHButtonGroup( this );
- buttonGroupActions->hide();
- _buttonCount = 0;
+ buttonBox = new QHBox( mainFrame, "Button Box" );
- buttonLayout = new QHBoxLayout( detailsFrame );
- detailsLayout->addLayout( buttonLayout );
+ _buttonCount = 0;
mainLayout->addWidget( detailsFrame );
+ mainLayout->addWidget( buttonBox );
detailsFrame->hide();
+ buttonBox->hide();
@@ -98,3 +99,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
- connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
+
+ signalMapper = new QSignalMapper( this );
+
+ connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
@@ -185,7 +189,9 @@ void MainWindow::setCurrent(QListViewItem *item)
for (uint i = 0; i < acts.count(); i++){
- button = buttonGroupActions->find( i );
+ button = buttonMap[i];
if (!button) {
- button = new QPushButton( detailsFrame );
- buttonLayout->addWidget( button, 0 );
- buttonGroupActions->insert( button, i);
+ qWarning(" no button for %s", (*acts[i]).latin1() );
+ button = new QPushButton( buttonBox );
+ buttonMap.insert( i, button );
+ signalMapper->setMapping(button, i );
+ connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
}
@@ -195,3 +201,3 @@ void MainWindow::setCurrent(QListViewItem *item)
for (uint i = acts.count(); i < _buttonCount; i++){
- button = buttonGroupActions->find( i );
+ button = buttonMap[i];
if (button) button->hide();
@@ -200,3 +206,8 @@ void MainWindow::setCurrent(QListViewItem *item)
detailsFrame->show();
- }else detailsFrame->hide();
+ buttonBox->show();
+
+ }else {
+ detailsFrame->hide();
+ buttonBox->hide();
+ }
popupTimer->start( 300, true );
@@ -255,3 +266,3 @@ void MainWindow::slotAction( int act )
{
- if (_currentItem->rtti() == OListViewItem::Result){
+ if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){
ResultItem *res = (ResultItem*)_currentItem;
@@ -262,3 +273,3 @@ void MainWindow::slotAction( int act )
-void MainWindow::optionChanged(int i)
+void MainWindow::optionChanged(int )
{